Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a classifieds website.

I use PHP, MySql, and SOLR.

Solr uses a Servlet Container, in my case JETTY, which is java application.

I just noticed that something was terribly wrong on my website. I opened the terminal and entered the "top" command and noticed that JAVA was EATING all the cpu and mem.

Now I thought "Ok, maybe I need more mem and cpu" So I increased it. But along with the increase the java app started eating more.

This has never happened before, and it is either a bug, or a hack of some kind.

Anyways, I need to troubleshoot this now, and so I wonder how do I do this?

Can I somehow pinpoint exactly when the memory usage started to go up from some error log?

How does one troubleshoot this?

How do I prevent it? Is it possible to prevent too many requests somehow, if they are within a timeline?

Thanks

share|improve this question

3 Answers 3

How much RAM are you using? SOLR has a known issue dealing with FieldCache which can cause it to eat huge amounts of memory while doing sorted searches.

Edit:

Okay, try using pmap -d on your big three processes (httpd/php, MySQL, Jetty) and see if some sub-library is eating up all your memory.

share|improve this answer
    
I have 4GB of ram at my disposal. Java is only using 2% of this. –  Anonymous12345 Dec 7 '10 at 16:51

Your java process is always goind to eat as much as the -Xmx value. When it reaches this value, it starts to recycle its memory.

If you want lower memory usage and if your application works fine with it, you just need to tune down your JVM Xmx parameter.

I've once got a memory leak in a C library called by one java program, that kept the process memory usage growing, while the Java heap was stable. But that's very unlikely.

There are plenty of tools to watch your java heap, but you should start by logging a few java.lang.Runtime.totalMemory ...

share|improve this answer

I believe that there might be some virus or spy attack on your server. Scan your server with some of best antivirus and spyware softwares.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.