Search code examples
rubynode.jseventmachinegoliath

Goliath poor performance: short response time, long wait time


So I'm use Goliath to develop an api, /list/users, it is very simple, just query mysql and return.

the request itself takes Response Time: 53.84ms, but if I do a press test with 10 threads to request the server by ab, I can only get 20 requests/second.

At meantime, I access the request in Chrome, I saw wait time: 400ms

What is wrong? how can I improve it?

I also created a nodejs version /list/users. the request itself also takes about 50ms, but I can get 130 requests/second when press test, and the wait time is almost 10ms.

Do I did something wrong, is there any setting need to be done fr Goliath?

And also I want to know why nodejs can have more requests/second since the single request response time is same?


Solution

  • Did you run goliath in Production mode? In development it does code reloading which will negatively impact performance. -e prod will put the server in production mode.