I’m running the same app with the same database. In development (my
laptop which has 2GB of RAM running Debian):
Cache write (will save 32.97ms): Product.count
Rendered shared/_search (36.8ms)
Rendered shared/_footer (0.5ms)
Completed in 153ms (View: 72, DB: 44) | 200 OK
[http://localhost/products]
Seems decent…
In production, I’m on Ubuntu (Xen Slice) with 512MB of RAM:
Rendering template within layouts/products
Rendering products/index
Completed in 25837ms (View: 109, DB: 25717) | 200 OK
[http://www.foo.com/products]
The difference in completed time (153mx vs 25837ms) is staggering to me.
Can anyone give me a hint as to where to look for problems? I just
can’t imagine that the ram alone is making that much of difference…
For kicks I ran the server in development mode (webrick) and got this:
Rendering template within layouts/products
Rendering products/index
Completed in 17956ms (View: 257, DB: 17629) | 200 OK
[http://foo.com/products]
Which is still pretty slow. Is there a tweak I might need to make to
MySQL on the server? Else what could explain the huge difference in
speeds?
Which is still pretty slow. Is there a tweak I might need to make to
MySQL on the server? Else what could explain the huge difference in
speeds?
Thanks in advance…
is there size difference between you development and production
databases? how many rows does table ‘products’ contain in production db?
what technology is used in your production server to dispatch request to
your ruby application (i mean, cgi or fastcgi or some advanced stuff
like Passenger or something)?
is there size difference between you development and production
databases? how many rows does table ‘products’ contain in production db?
what technology is used in your production server to dispatch request to
your ruby application (i mean, cgi or fastcgi or some advanced stuff
like Passenger or something)?
They are the identical db’s… about 97000 records. On the development
side I’m using mongrel and in production I have Apache + Passenger.
To experiment I also set up a slice with 768 MB of RAM using lighttpd +
fastcgi. Results are about the same:
Rendering template within layouts/products
Rendering products/index
Completed in 23.66300 (0 reqs/sec) | Rendering: 0.11429 (0%) | DB:
23.40731 (98%) | 200 OK [Foo.com]
I checked the my.cnf files on my development and deployment setups and
they were identical. Increasing the query_cache_limit and
query_cache_size on the server helped a bit… the first page load is
still very slow, but subsequent (immediate) loads are faster.
is there size difference between you development and production
databases? how many rows does table ‘products’ contain in production db?
what technology is used in your production server to dispatch request to
your ruby application (i mean, cgi or fastcgi or some advanced stuff
like Passenger or something)?
They are the identical db’s… about 97000 records. On the development
side I’m using mongrel and in production I have Apache + Passenger.
i suspect that you have an index on some field in development database,
but not in production. Maybe a table w/o primary key, maybe some
missed-in-action migration or something. You should check metadata.
Dunno exactly how to perform this in MySQL, afaik MySql 5 and higher
contain INFORMATION_SCHEMA tables.
I’m running the same app with the same database. In development (my
laptop which has 2GB of RAM running Debian):
Cache write (will save 32.97ms): Product.count
Rendered shared/_search (36.8ms)
Rendered shared/_footer (0.5ms)
Completed in 153ms (View: 72, DB: 44) | 200 OK
[http://localhost/products]
Seems decent…
In production, I’m on Ubuntu (Xen Slice) with 512MB of RAM:
Rendering template within layouts/products
Rendering products/index
Completed in 25837ms (View: 109, DB: 25717) | 200 OK
[http://www.foo.com/products]
The difference in completed time (153mx vs 25837ms) is staggering to me.
Can anyone give me a hint as to where to look for problems? I just
can’t imagine that the ram alone is making that much of difference…
For kicks I ran the server in development mode (webrick) and got this:
Rendering template within layouts/products
Rendering products/index
Completed in 17956ms (View: 257, DB: 17629) | 200 OK
[http://foo.com/products]
Which is still pretty slow. Is there a tweak I might need to make to
MySQL on the server? Else what could explain the huge difference in
speeds?
Thanks in advance…
This looks strange.
RAM could be the problem on liunux box. You have 512M, but how much is
really available to be used? Try top command to find how much of 512M is
really available for your application.
Option 2 is run the app in production on your desktop and then compare
the production logs on your desktop with the one on Linux box. rawk
(Ruby on Rails Log Analyzer – RAWK | Dogpatch Happenings)
should be helpful to analyze quickly
regards,
Ashutosh
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.