onebusaway-application-modules icon indicating copy to clipboard operation
onebusaway-application-modules copied to clipboard

OutOfMemory when running two app in same tomcat with -xmx2048m

Open zhumingvictor opened this issue 11 years ago • 12 comments

When I run each alone it works fine, but when I run both I keep getting OutOfMemory PermGen Error. I already increased xmx to 2048m, anything I can do about this?

zhumingvictor avatar Jun 15 '14 03:06 zhumingvictor

See: https://github.com/OneBusAway/onebusaway/wiki/Troubleshooting#exceptions-related-to-memory-when-trying-to-start-up-tomcat-with-the-webapps On Jun 14, 2014 11:40 PM, "Ming" [email protected] wrote:

When I run each alone it works fine, but when I run both I keep getting OutOfMemory PermGen Error. I already increased xmx to 2048m, anything I can do about this?

— Reply to this email directly or view it on GitHub https://github.com/OneBusAway/onebusaway-application-modules/issues/94.

barbeau avatar Jun 15 '14 03:06 barbeau

Hi Barbeau,

I know that trouble shooting page and in my post I already mentioned I already increased xmx to 2048m and also max perm size to 128m. But I still getting the same problem. And as I said deploy each alone is fine, but when deploy both I got this problem. My service memory has 2048m, it won't make any sense to further increase my dev environment java heap size and perm size.

Thanks.

zhumingvictor avatar Jun 15 '14 04:06 zhumingvictor

No one having the same problem?

zhumingvictor avatar Jun 16 '14 03:06 zhumingvictor

How much RAM does the machine have? Can you paste your entire config string for us?

On Sun, Jun 15, 2014 at 11:35 PM, Ming [email protected] wrote:

No one having the same problem?

— Reply to this email directly or view it on GitHub https://github.com/OneBusAway/onebusaway-application-modules/issues/94#issuecomment-46138628 .

sheldonabrown avatar Jun 16 '14 10:06 sheldonabrown

Hi, I just tried to deploy the one with 300MB bundle alone to my server, and it either outofmemoryor stackoverlfow exception. The server has 2GB ram.

When I set JAVA_OPTS = -Xmx256M -XX:MaxPermSize=128m -Xss512k for tomcat. It gives stackoverflow.

When I set JAVA_OPTS = -Xmx256M -XX:MaxPermSize=128m -Xss1024k for tomcat. It gives outofmemory error.

zhumingvictor avatar Jun 16 '14 16:06 zhumingvictor

You initially reported the out of memory was specifically PermSize. 128m is not a log for permanent generation heap.

Can you try larger settings such as the following?

JAVA_OPTS = -Xmx768M -XX:MaxPermSize=256m -Xss1024k

On Mon, Jun 16, 2014 at 12:55 PM, Ming [email protected] wrote:

Hi, I just tried to deploy the one with 300MB bundle alone to my server, and it either outofmemoryor stackoverlfow exception. The server has 2GB ram.

When I set JAVA_OPTS = -Xmx256M -XX:MaxPermSize=128m -Xss512k for tomcat. It gives stackoverflow.

When I set JAVA_OPTS = -Xmx256M -XX:MaxPermSize=128m -Xss1024k for tomcat. It gives outofmemory error.

— Reply to this email directly or view it on GitHub https://github.com/OneBusAway/onebusaway-application-modules/issues/94#issuecomment-46204323 .

sheldonabrown avatar Jun 16 '14 17:06 sheldonabrown

Still the same problem on the server, the only way to run both is on my workstation with JAVA_OPTS = -Xmx2G -XX:MaxPermSize=128M -Xss1M.

I am only trying to run the web api. Why so much memory needed?

zhumingvictor avatar Jun 16 '14 17:06 zhumingvictor

Great, then you no longer have an issue? It sounds like you know what you need to do.

On Mon, Jun 16, 2014 at 1:12 PM, Ming [email protected] wrote:

Still the same problem on the server, the only way to run both is on my workstation with JAVA_OPTS = -Xmx2G -XX:MaxPermSize=128M -Xss1M

— Reply to this email directly or view it on GitHub https://github.com/OneBusAway/onebusaway-application-modules/issues/94#issuecomment-46206526 .

sheldonabrown avatar Jun 16 '14 17:06 sheldonabrown

But a web app with only 300mb of data needs that much memory to run, that just doesn't seem to be right. It is a web app and with only one user accessing it. How come it needs so much memory? Especially all of those data are static data, Just imagine 1000 user accessing it at the same time how much memory it require then?

zhumingvictor avatar Jun 16 '14 17:06 zhumingvictor

I may need some more information as to your setup, but I can tell you that the transit data bundle is loaded into memory by design. That requires physical memory, not just virtual memory, based on how Java works. So it has less to do with your number of end users, and more to do with the size of the bundle.

Should you be unsatisfied with these answers, know that ehcache is what controls a good portion of the in memory storage of the transit data federation, and it is quite configurable. At the risk of slower overall performance (and much more disk access) you can tune OBA to require less memory.

On Mon, Jun 16, 2014 at 1:21 PM, Ming [email protected] wrote:

But a web app with only 300mb of data needs that much memory to run, that just doesn't seem to be right. It is a web app and with only one user accessing it. How come it needs so much memory?

— Reply to this email directly or view it on GitHub https://github.com/OneBusAway/onebusaway-application-modules/issues/94#issuecomment-46207622 .

sheldonabrown avatar Jun 16 '14 18:06 sheldonabrown

You mean the whole bundle will stay in memory all time? That must be the reason then. I saw a sub project that loads the bundle into DB (e.g mysql) if the data is pulled from a dedicated db that will release lots of memory. Is it possible to make the web app pointing to a db bundle? If this is possible it would be the best solution for memory consumption and performance as we can always tuning the performance on DBMS by add index etc.

zhumingvictor avatar Jun 16 '14 18:06 zhumingvictor

Yes, essentially the entire bundle is in memory.

I have no experience with the sub project, but I suspect that it is instead about loading GTFS into a relational database, not about using a transit data bundle backed by a database.

The design of the transit data interface should make this easily achievable, but it would take some work.

On Mon, Jun 16, 2014 at 2:34 PM, Ming [email protected] wrote:

You mean the whole bundle will stay in memory all time? That must be the reason then. I saw a sub project that loads the bundle into DB (e.g mysql) if the data is pulled from a dedicated db that will release lots of memory. Is it possible to make the web app pointing to a db bundle? If this is possible it would be the best solution memory consumption and performance as we can always tuning the performance on DBMS by add index etc.

— Reply to this email directly or view it on GitHub https://github.com/OneBusAway/onebusaway-application-modules/issues/94#issuecomment-46216670 .

sheldonabrown avatar Jun 16 '14 18:06 sheldonabrown