Server getting slow after X hours

October 22, 2016 1.4k views
Server Optimization


They are terrible days to figure out the issue. I could not.

My API needs to received many requests with low latency. About 300K requests/day. After received > 5K requests, my server is getting slow. After 2 or 3 hours, my server cannot receive any request. All are showing pending.

My Server 2GB/2CP ubuntu 14.

I do check CPU and RAM - they show < 30%. My API is on spring mvc, my server is jetty (using jetty - maven plugin)

Some configs before starting server:
export MAVEN_OPTS="-Xmx2048m -Xms1024m"
mvn -DhttpPort=80 jetty:run


1 Answer

Sounds like you've got a bit of a mystery. Normally my first guess would be that there is a memory leak somewhere and over time your memory use is increasing but you've mentioned that this doesn't seem to be the case. Are you running any type of http server like apache in front of jetty? I have seen issues with the KeepAlive setting and KeepAliveTimeout in apache causing a wait time on connection while the service waits for an available thread. That can usually be resolved by disabling KeepAlive.

It's been a while since you initially posted this (sorry for not getting back to you sooner), were you able to find the source of the problem?

Have another answer? Share your knowledge.