Does Struts 2 have any memory issues - struts2

I have a webapp developed with struts2 deployed in tomcat 5.5. The server has other applications deployed in it. But the app created with struts2 is very slow. Any ideas? How does Struts 2 handle object creation? And is there anything I can do on the tomecat server..

How slow is it? What are you doing? are you sure it is Struts 2 that is slow and not your application code? Did you do any profiling? What were the results?
Check this out: http://struts.apache.org/2.2.1/docs/performance-tuning.html
I found serving the static content from a folder increased the speed.

Well few details are really required for some one to answer your question in more good way
Which Struts2 version you are using
At which place/part do you think application is slow
as per my experience there are certain areas where Struts2 have known problems, OGNL in itself sometime creates problem since this is the part of the framework which took most of the time, this has been known to fixed in 3.x version of OGNL so you can get new jar of OGNL and than can test your application.
Second use some profiler and it will help you to catch the culprit like any thread blocking etc.

What OS is Tomcat running on?
If it's Linux, you may have run into a lack of entropy issue.
If this command returns something less than 200, it could explain your issue:
cat /proc/sys/kernel/random/entropy_avail
If it is low (or watch during startup/making requests), try pointing /dev/random to /dev/urandom. (Not for secure Production, but to test in Dev should be fine):
mv /dev/random /dev/random.orig
ln -s /dev/urandom /dev/random
And try starting Tomcat again.

Related

ExtJs 3.4, ExtDirect, Symfony and PHP 8.2 -> no data is returned

We are currently upgrading PHP form 7.1 to PHP 8.2 for a legacy application which uses Apache, FriendsOfSymfony 1.5.15, ExtJs 3.4 and ExtDirect.
The following problem occurs: Sending a request to the Symfony backend creates the result as expected. The ExtDirect plugin, dsExtDirectPlugin, handles the request and response until a certain point in the dsExtDirectRouter.class.php where the code echos the response from the Symfony endpoint:
echo json_encode(self::$response);
From this point on Symfony shutdowns down logging,... and I expect that the response echod is used in JavaScript from that point on, but in the Firefox development tools, I see "no data available" in the network tab. So the output doesn't seem to come to the frontend / is suppressed from being echod?
Does anyone have a clue what can cause this? Do I need an additional php or apache config?
Thanks and kind regards,
Dirk
I found the solution for my prolbem: fastcgi_finish_request seems to be executed too early. Probably there's still some kind of misconfiguration on the Apache / PHP. If I directly add the fastcgi_finish_request call after the result "echo" and comment out the method call in the sfWebResponse (cached) class, it works. Of course not the final solution to comment something out in a commented class, but at least knowing the problem is a first step to the final solution.

JBoss newbie can't load app to custom port

Thanks in advance for your patience. I'm a recent "convert" to JBoss, having the maintenance of an application thrust upon me, and so long as we don't touch it, it works just fine. However, the mandate has come down to port the app from Solaris to Linux Fedora, using version 4.2.3GA.
I am using the jboss-port-bindings.xml to specify the ports I want to use, but when I bring JBoss up it loads to standard port 8080 rather than 40029 like I specify in the file. I have triple-checked the configuration and it's set up on the Linux box exactly the way it's set up on the Solaris box - all the required files are where they are supposed to be, etc.
Anybody have an idea as to why I can't use the specified ports? If you need more information than what I have supplied, please just ask.
We found the problem. The jboss-service.xml file we had in the server/default/conf folder was correct, but we also needed to add the same file to the server/appname/config file, where appname is the name of our application. This told the app where to go looking for the jboss-port-bindings.xml file and now everybody's happy.
Don't know why we didn't have to have that configuration under Solaris, but anyway, this solved the problem. Thanks to those who had a look at the question. Chalk this one up to experience.

Repeated "java.lang.IllegalStateException: Cannot forward after response has been committed" errors with Grails and Tomcat

Please see my post on the Grails user mailing list. Essentially, I get the error "Cannot forward after response has been committed" with Grails 2.x after every few requests. This happens for all types of URLs, controllers, GSPs, CSS files, JS files and even image files. I have tried Grails 2.0.0 and Grails 2.0.1 with Tomcat 6.0.35 and Tomcat 7.0.25 on Windows XP 32-bit, Windows 7 32-bit and Centos 64-bit. The error comes up on all these combinations.
As I have mentioned in my post, there are no response.redirect or response.forward statements in our code. This is causing severe problem on our production application so need help in determining what else can be looked at to get to the bottom of the problem.
This has been solved. In one of the controllers in the application, response output stream was being directly written to but not closed explicitly after the operation was over. It seems Tomcat and Jetty recycle response objects. When a response object that did not have their output stream closed earlier was recycled for a future request and redirect was performed on it, the redirect would fail.
The code has been changed and the error has disappeared now. The lesson learned is that any time such an error occurs, scan the entire code base for direct access to response output stream and close output stream responsibly before existing controller methods.
You should create a new grails application and move the controllers, domains and etc yourself rather than grails update.
When you do that also make sure you look into the configuration files of grails.
Also take a look at what plugins you have.
Also, when moving the files, try out the application once in a while when it is possible, and perhaps you can detect when the error arises. Start out by trying it in your most basic controller and see if the error is there then as well.
Good luck.

Modifying Grails apps post deployment

I'm investigating Grails vs. other Agile web frameworks, and one key use case I'm trying to support is the ability to modify controllers and install plugins post deployment. It appears that this isn't possible with Grails, but I want to make sure before I write it off.
As far as modifying controllers goes, it would be sufficient if the Groovlet behavior existed (compile-on-demand).
As far as plugin installs go, I understand this may be a long shot, but I thought I'd check to be sure.
For your information, I need this because I work on a product that requires a little site-specific customization, such as adding validation of simple meta-data, integrating with customer security environments, and maybe even including new controllers/pages quickly.
Out of the box, no, grails doesn't really support what you want. There may be ways to customize it but I've never looked into it. A PHP framework might be more of your ally since there is no real deployment process other than copying PHP files to a location.
That said, I personally would prefer a strict set of deployment policies. And honestly, deploying changes with Grails is as simple as running the 'grails war' command and copying that war to your servlet container. The site's downtime is negligible and if you have multiple web servers with a load-balancer, your customers should never see down time due to deployments.
Although it's not recommended for complex coding; You could execute groovy code from a string that you could store in database or a file on the fly at run time:
check out Groovy template engine:
http://groovy.codehaus.org/Groovy+Templates
but even then, you are still limited on what you can do or can't do let alone debugging will lack. you may want to consider an interpreted language; few to mention PHP/Perl/Coldfusion.

PHP Command-line scripts are ignoring php.ini and ini_set('memory_limit',...) directives

I am facing the common "Fatal error: Out of memory (allocated 30408704) (tried to allocate 24 bytes)..." PHP Fatal error. Pages served via Apache are not exhibiting this behavior.
I've tried the following:
Increasing the memory_limit in php.ini to a much larger value.
Increasing memory_limit within the script itself via calls to ini_set('memory_limit', -1), ini_set('memory_limit', '-1'), ini_set('memory_limit', 100000000), ini_set('memory_limit', '128M'), etc.
unset()ing unneeded arrays and objects to encourage the garbage collector to free up memory.
Contacting the web host. They are normally very capable and knowledgeable, but have not been able to help me with this issue either.
I've tried explicitly including a php.ini file using the -c command-line flag to hand-pick specific php.ini files with various values.
I've tried setting memory_limit in php.ini using both raw numbers of bytes and values such as 64M, 128M, etc.
The hosting provider was able to run the script as root with no issues, but experiences the same issue I do when running it using my non-root user. Perhaps there is some kind of permissions issue involved?
Regardless of what I try, the error message is the same. It appears that my command line scripts are ignoring changes to memory_limit.
I tend to try to make sure my scripts are memory efficient, but I'm currently needing to parse large amounts of HTML via Simple HTML DOM and it is in the parser that I'm experiencing out of memory issues. In an attempt to reduce the memory footprint of the script, I've tried using DOMDocument instead. This does not help either. In fact, the out of memory error is now triggered elsewhere in the script.
My question: has anyone experienced this or a similar issue? Do you have any recommendations?
Thank you.
It turns out that the problem was caused by shell fork bomb protection being enabled on the server that was placing a hard memory limit on all command-line scripts. This had been enabled by my web host without my knowledge.
your PHP on cli may be using a different php.ini to your apache php. try a phpinfo() and check its using the ini file you think its using.

Resources