Please, evaluate performance. Did I miss something?...
Hi everyone,
Have been doing one project on my spare time, and now as it is 80+% ready, time to think about performance.
http://hotweb.lt - feel free to visit :) It is a site being built on Drigg modules and some complementary ones. Have no plans to use Views or CCK. Maybe in the near future will be some modules for community building. No hacks on Drupal 6 core and no changes to DB structure are made.
Some facts:
Not using APC or eAccelerator.
Site is running on Servint VPS with 768 MB Guaranteed (1.5 GB Burst RAM) with Cpanel and most other services enabled. There are some more sites on this VPS, but they are mostly static and not affecting overall performance.
Lets start with back end, please, check MySQL config, if I am not missing something very obvious:
skip-networking
skip-innodb
log-slow-queries
safe-show-database
thread_concurrency = 8
max_delayed_threads=20
max_tmp_tables=32
tmp_table_size = 16M
query_cache_type = 1
query_cache_size = 16M
query_cache_limit = 1M
thread_cache_size = 32
max_connections = 50
max_user_connections = 50
key_buffer = 8M
key_buffer_size = 16M
record_buffer=16M
myisam_sort_buffer_size = 4M
join_buffer_size = 256K
read_buffer_size = 256K
sort_buffer_size = 512K
table_cache = 1024
interactive_timeout = 25
wait_timeout = 1000
connect_timeout = 10
max_allowed_packet = 16M
max_connect_errors = 999999
innodb_buffer_pool_size=2M
innodb_additional_mem_pool_size=500K
innodb_log_buffer_size=500K
Apache config:
Worker MPM
StartServers 4
MaxClients 40
MinSpareThreads 5
MaxSpareThreads 20
ThreadsPerChild 20
MaxRequestsPerChild 1000
KeepAlive On
KeepAliveTimeout 3
Timeout 30
Front end:
YSlow results top page score: 90, getting 85-92 depending on page, so lets assume that front end works well.
A is everywhere, exept
B "This page has 10 external background images. Try combining them with CSS sprites." - understood, WILL DO that soon!
F on Use a Content Delivery Network (CDN) - WILL NOT do that, because site is for 1 country only, it will be moved to more powerful server if neccessary.
B on Add Expires headers - QUESTION: is it ok to add Expires headers on non dynamicaly generated files, such as profile pictures, as I will have up to 10-15 different ones on each page?... The only problematic file is favicon.ico
Drupal settings:
CSS aggregation ON
JS aggregation ON
JS minify ON
GZip CSS ON
Page compression - ON
GZip JavaScript ON - everlasting QUESTION: is it better to gzip pages, JS and CSS using Apache or Drupal?
Thank you for your thoughts...


Benchmark and APC
If you are expecting modest traffic, you may be able to be OK with not having an op-code cache. If you are expecting any level of traffic, or just to be more efficient, then I strongly recommend that you install APC (or eAccelerator if you do not get seg faults with it).
You do not say if you have the page cache on or not.
Also, depending on the audience, boost may provide a nice "boost" for your site for anonymous users.
The other thing is that you benchmark the site and see how many requests per second and how many users it can take with some of the above on and off.
Start with ab if it is already on the server.
Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.
Thanx Khalid - for now, I
Thanx Khalid - for now, I just want to have proper MySQL, Apache and Drupal settings. I am not using any cahcing, exept "Normal" in /settings/performance. I will add caching step-by-step, probably start with eAccelerator, then think something like Boost.
In your opinion Apache and MySQL configs are more or less ok?
---
naslenas.com. Drupal blog experiment.
Content Type + MySQLTuner, GZip
I also concur with kbahey upon using APC or eAccelerator for caching.
Another thing you should keep aware is when it comes to the Drupal site, content type should be what is watched upon. Boost is good for static/hardly ever changing content (i.e. blogs, simple sites). Memcache is better for both static and highly dynamic content (i.e. media pages, pictures, daily updated content). Memcache can even be tuned to use session tables, thus allowing for greater response if/when needed in the future.
I recommend downloading and running MySQLTuner (http://wiki.mysqltuner.com/MySQLTuner). It can help make recommendations for performance and stability needs under the MySQL environment. One thing you need to keep in mind is that MySQL is more 'memory' driven than disk driven -- HOWEVER -- disk reads & writes (I/O) can play a major factor as well if your site is hammered upon from the outside world.
When it comes to GZip Compression for JavaScript and CSS, I recommend going with the Apache side rather than the Drupal side. On the Apache side, CPU cycles are utilized rather than having to let Drupal handle memory allocation needs which can result in additional site performance impact.
-- M
Thank you for reply! Seems,
Thank you for reply!
Seems, that APC or eAccelerator is (the first on) the way to go, but...
I was asking more about basic Apache and MySQL stuff - because at this moment I do not have infrastructure, just 768RAM VPS, that is all. Have been using and developing for Drupal for ~year, and I find it VERY powerful as a platform, but with serious performance bottleneck. Why I am focusing that much on Apache and MySQL - it is the backbone of LAMP stack (I cannot tweak Linux or disk I/O settings, because it is VPS...) and it is cappable to huge performance gains WIHOUT side effects. When they are tuned for Drupal, just then add some extra stuff: eAccelerator, proxy, etc..
Now will try to disable Drupal gzipping and enable on Apache side. The next probably is mod_cache to try, and just then eAccelerator (which I prefer over APC), Boost.
BTW, Swampcritter, I saw you porsts: you are offering to go with DeflateCompressionLevel 9 ?
I can offer you to try DeflateCompressionLevel 1 or 2, because it still properly compresses pages, like 110-130% of lev 9 size, BUT with 1/3 of CPU power. It may be an issue on millions of pageviews. It is like WinZip's "best" compression - it does compress better, but it is so slow. Try! ;)
Now downloading MySQLtuner
---
naslenas.com. Drupal blog experiment.
GZIP Compression
We are using DeflateCompressionLevel 9 due to the type of sites we are running (i.e. highly dynamic, multimedia content).
One other thing you might consider on the MySQL side is setting up TmpFS since MySQL runs better with more memory allocated to it (http://www.koopman.me/2008/11/using-tmpfs-for-mysql-tmpdir-setting/)
-- M
DeflateCompressionLevel 9 is
DeflateCompressionLevel 9 is way too expensive in cpu resources, but if you have zillion of cpu cores - it does not matter.
Thanx, I am reading the link you gave. Currently this site is on VPS and I do not have much flexibility on lowest level of configuration.
---
naslenas.com. Drupal blog experiment.