Eric Berry
2011-10-27 05:28:51 UTC
Hello, I've been setting up a benchmark for my company lately where I'm
testing Grails against PHP. The PHP framework is a home-brewed MVC that the
company built in the last few years.
I'm seeing a gross difference in favor of PHP at higher connection counts
(200+).
The PHP app was done by another developer as I don't know PHP well enough.
But here's a summary of the set up.
The benchmark is set up on 4 nodes in EC2 - Large Standard Instances.
Node1: Benchmark tool (Faban)
Set up to do 3 HTTP requests
Request 1: GET the "create" page.
Simple "user" form with fields for first and last name.
Request 2: POST to the "save" action which results in just the
new User's ID rendered as content.
Request 3: GET the "show" page based on the ID from the previous
POST request.
Node2: Mock User-API (REST - Jersey, Jackson)
User objects are stored in memory using a hashmap
ID's created using System.currentTimeMillis()
Maximum recorded request time 93ms
Over the last few days.
Node3: Grails app (Tomcat 6)
Set up in Production mode using in memory DB. The DB is not used,
all data comes from a UserService
UserService uses RESTClient (rest plugin) to make rest calls to mock
user-api.
UserService marked with transactional = false
Node4: PHP app
Uses APC cache
Up to about 200 concurrent users Grails and PHP is neck and neck. After 200
concurrent users Grails starts to drastically fall behind.
I start seeing Tomcat errors complaining about the 200 thread limit being
reached. If I increase it, I get "Too Many Files Opened" errors.
One thing I notice is that there are significantly long requests. Especially
at the beginning of the run and randomly throughout the steady-state. These
long requests take upwards of 45 seconds to complete.
The heap is set to 1024m, and I'm using ConcMarkSweep, and ClassUnloading
(thinking it might be a GC issue).
The odd thing about these long requests is that the monitoring I have in
place on the mock api side shows that the longest running request rarely
goes over 100ms. Once I had a long request go to 200ms.
My issue is that I'm not seeing the same behavior from the PHP app. At 400
concurrent users the Grails app struggles, and fails to keep the avg request
time below 1 sec and maxes out at around 300 req/sec and I start to see
connection timeout errors. The PHP app seems to run smoothly and keeps the
avg. request time below 1 sec. and takes around 500 req/sec with no
timeouts.
I'd like to ask the Grails community for some help. Are there areas in
Grails I should look out for, known issues, or common performance tunes I
can do to Grails/Tomcat? I can't imagine PHP doing so significantly better
than Grails.
Any help, or advice would be greatly appreciated.
Thanks,
Eric
testing Grails against PHP. The PHP framework is a home-brewed MVC that the
company built in the last few years.
I'm seeing a gross difference in favor of PHP at higher connection counts
(200+).
The PHP app was done by another developer as I don't know PHP well enough.
But here's a summary of the set up.
The benchmark is set up on 4 nodes in EC2 - Large Standard Instances.
Node1: Benchmark tool (Faban)
Set up to do 3 HTTP requests
Request 1: GET the "create" page.
Simple "user" form with fields for first and last name.
Request 2: POST to the "save" action which results in just the
new User's ID rendered as content.
Request 3: GET the "show" page based on the ID from the previous
POST request.
Node2: Mock User-API (REST - Jersey, Jackson)
User objects are stored in memory using a hashmap
ID's created using System.currentTimeMillis()
Maximum recorded request time 93ms
Over the last few days.
Node3: Grails app (Tomcat 6)
Set up in Production mode using in memory DB. The DB is not used,
all data comes from a UserService
UserService uses RESTClient (rest plugin) to make rest calls to mock
user-api.
UserService marked with transactional = false
Node4: PHP app
Uses APC cache
Up to about 200 concurrent users Grails and PHP is neck and neck. After 200
concurrent users Grails starts to drastically fall behind.
I start seeing Tomcat errors complaining about the 200 thread limit being
reached. If I increase it, I get "Too Many Files Opened" errors.
One thing I notice is that there are significantly long requests. Especially
at the beginning of the run and randomly throughout the steady-state. These
long requests take upwards of 45 seconds to complete.
The heap is set to 1024m, and I'm using ConcMarkSweep, and ClassUnloading
(thinking it might be a GC issue).
The odd thing about these long requests is that the monitoring I have in
place on the mock api side shows that the longest running request rarely
goes over 100ms. Once I had a long request go to 200ms.
My issue is that I'm not seeing the same behavior from the PHP app. At 400
concurrent users the Grails app struggles, and fails to keep the avg request
time below 1 sec and maxes out at around 300 req/sec and I start to see
connection timeout errors. The PHP app seems to run smoothly and keeps the
avg. request time below 1 sec. and takes around 500 req/sec with no
timeouts.
I'd like to ask the Grails community for some help. Are there areas in
Grails I should look out for, known issues, or common performance tunes I
can do to Grails/Tomcat? I can't imagine PHP doing so significantly better
than Grails.
Any help, or advice would be greatly appreciated.
Thanks,
Eric
--
Learn from the past. Live in the present. Plan for the future.
Blog: http://eric-berry.blogspot.com
jEdit <http://www.jedit.org> - Programmer's Text Editor
Bazaar <http://bazaar.canonical.com> - Version Control for Humans
Learn from the past. Live in the present. Plan for the future.
Blog: http://eric-berry.blogspot.com
jEdit <http://www.jedit.org> - Programmer's Text Editor
Bazaar <http://bazaar.canonical.com> - Version Control for Humans