<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>William&#039;s Blog &#187; APC</title> <atom:link href="http://www.willdurand.fr/tag/apc/feed/" rel="self" type="application/rss+xml" /><link>http://www.willdurand.fr</link> <description>Développeur web indépendant, étudiant et passionné ! #Symfony2 #Rails #Diem #Git #Nginx #WebPerfs #SoftwareQuality</description> <lastBuildDate>Thu, 20 Oct 2011 14:59:05 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Dédibox v3 : Nginx + PHP-FPM + Apache2 + APC + Memcached + MySQL</title><link>http://www.willdurand.fr/dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql</link> <comments>http://www.willdurand.fr/dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql/#comments</comments> <pubDate>Sun, 11 Jul 2010 22:55:31 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Serveur]]></category> <category><![CDATA[Sysadmin]]></category> <category><![CDATA[Apache2]]></category> <category><![CDATA[APC]]></category> <category><![CDATA[Dedibox]]></category> <category><![CDATA[Memcached]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[Nginx]]></category> <category><![CDATA[PHP-FPM]]></category> <category><![CDATA[PHP5]]></category> <category><![CDATA[Postfix]]></category><guid
isPermaLink="false">http://www.willdurand.fr/?p=520</guid> <description><![CDATA[Bonjour J&#8217;ai récemment pris une Dédibox v3 et pour le moment j&#8217;en suis très satisfait. On m&#8217;a pas mal sollicité ces derniers temps pour que j&#8217;explique comment j&#8217;ai configuré ce serveur ainsi que les services que j&#8217;ai pu mettre en place. C&#8217;est l&#8217;objet de cet article. Premièrement, j&#8217;utilise Debian depuis toujours et c&#8217;est logiquement ce [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;">Bonjour <img
src='http://www.willdurand.fr/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p><p
style="text-align: justify;">J&#8217;ai récemment pris une Dédibox v3 et pour le moment j&#8217;en suis très satisfait. On m&#8217;a pas mal sollicité ces derniers temps pour que j&#8217;explique comment j&#8217;ai configuré ce serveur ainsi que les services que j&#8217;ai pu mettre en place. C&#8217;est l&#8217;objet de cet article.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Premièrement, j&#8217;utilise Debian depuis toujours et c&#8217;est logiquement ce qui tourne sur la Dédibox (en version 64 bits).</p><p
style="text-align: justify;"></p><p
style="text-align: justify;"><img
class="alignright" src="http://wiki.nginx.org/local/nginx-logo.png" alt="" width="350" height="90" /></p><p
style="text-align: justify;">Le serveur HTTP frontal n&#8217;est pas Apache2 mais <a
href="http://nginx.org/">Nginx</a> (<a
href="http://wiki.nginx.org/Main">wiki</a>) que j&#8217;ai appréhendé seulement depuis l&#8217;obtention de ce serveur. Et je dois avouer que j&#8217;en suis très satisfait, terriblement surpris d&#8217;ailleurs. Apache2 est bien en place mais sert de proxy à Nginx.</p><p
style="text-align: justify;">Nginx est couplé à <a
href="http://php-fpm.org/">php-fpm</a>. La paire formée est excellente et permet l&#8217;utilisation de <a
href="http://memcached.org/">Memcached</a> ou <a
href="http://php.net/manual/fr/book.apc.php">APC</a> sans soucis. Notons que l&#8217;excellent <a
href="http://www.dotdeb.org/">repository Dotdeb</a> fournit un package .deb de php-fpm. Ce repository est certainement un <strong>must-have</strong> puisque Debian n&#8217;est pas forcément très en avance sur les versions de PHP. Pour ma part, j&#8217;ai installé, via ce repository, PHP 5.3.2 ainsi que la dernière version d&#8217;APC (3.1.2 via <a
href="http://pecl.php.net/">pecl</a>). Comme je l&#8217;ai dit plus haut j&#8217;ai installé Memcached avec l&#8217;extension PHP qui va bien. Passons à la configuration.</p><p
style="text-align: justify;"></p><h2>Nginx</h2><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">user www-data;<br
/> worker_processes <span
style="color: #000000;">1</span>;<br
/> <br
/> error_log &nbsp;<span
style="color: #000000; font-weight: bold;">/</span>var<span
style="color: #000000; font-weight: bold;">/</span>log<span
style="color: #000000; font-weight: bold;">/</span>nginx<span
style="color: #000000; font-weight: bold;">/</span>error.log;<br
/> pid &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #000000; font-weight: bold;">/</span>var<span
style="color: #000000; font-weight: bold;">/</span>run<span
style="color: #000000; font-weight: bold;">/</span>nginx.pid;<br
/> <br
/> events <span
style="color: #7a0874; font-weight: bold;">&#123;</span><br
/> worker_connections <span
style="color: #000000;">1024</span>;<br
/> <span
style="color: #7a0874; font-weight: bold;">&#125;</span><br
/> <br
/> http <span
style="color: #7a0874; font-weight: bold;">&#123;</span><br
/> include &nbsp; &nbsp; &nbsp; <span
style="color: #000000; font-weight: bold;">/</span>etc<span
style="color: #000000; font-weight: bold;">/</span>nginx<span
style="color: #000000; font-weight: bold;">/</span>mime.types;<br
/> default_type &nbsp;application<span
style="color: #000000; font-weight: bold;">/</span>octet-stream;<br
/> <br
/> client_max_body_size 8M;<br
/> <br
/> sendfile &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;on;<br
/> keepalive_timeout &nbsp; <span
style="color: #000000;">15</span>;<br
/> tcp_nodelay &nbsp; &nbsp; &nbsp; &nbsp; on;<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Enable Gzip compression</span><br
/> <span
style="color: #c20cb9; font-weight: bold;">gzip</span> on;<br
/> gzip_disable <span
style="color: #ff0000;">&quot;MSIE [1-6].(?!.*SV1)&quot;</span>;<br
/> gzip_vary on;<br
/> gzip_comp_level <span
style="color: #000000;">3</span>;<br
/> gzip_proxied any;<br
/> gzip_types text<span
style="color: #000000; font-weight: bold;">/</span>plain text<span
style="color: #000000; font-weight: bold;">/</span>html text<span
style="color: #000000; font-weight: bold;">/</span>css application<span
style="color: #000000; font-weight: bold;">/</span>x-javascript text<span
style="color: #000000; font-weight: bold;">/</span>xml application<span
style="color: #000000; font-weight: bold;">/</span>xml application<span
style="color: #000000; font-weight: bold;">/</span>xml+rss text<span
style="color: #000000; font-weight: bold;">/</span>javascript;<br
/> gzip_buffers <span
style="color: #000000;">16</span> 8k;<br
/> <br
/> include <span
style="color: #000000; font-weight: bold;">/</span>etc<span
style="color: #000000; font-weight: bold;">/</span>nginx<span
style="color: #000000; font-weight: bold;">/</span>conf.d<span
style="color: #000000; font-weight: bold;">/*</span>.conf;<br
/> include <span
style="color: #000000; font-weight: bold;">/</span>etc<span
style="color: #000000; font-weight: bold;">/</span>nginx<span
style="color: #000000; font-weight: bold;">/</span>sites-enabled<span
style="color: #000000; font-weight: bold;">/*</span>;<br
/> <span
style="color: #7a0874; font-weight: bold;">&#125;</span></div></div><p
style="text-align: justify;">Le paramètre <em>worker_processes</em> dépend de votre processeur (multi-coeurs ou non). Dans le cas d&#8217;une Dédibox, on ne dispose que d&#8217;un processeur mono-coeur donc on fixe ce paramètre à <em>1</em>. Ensuite j&#8217;active la compression gzip, ce qui permettra de gagner un peu en performances (moins de données à envoyer d&#8217;un coup = plus de données envoyées en même temps).</p><p
style="text-align: justify;">Nginx va servir tous les fichiers statiques, les &laquo;&nbsp;assets&nbsp;&raquo; mais également les pages en cache. Il s&#8217;interface très bien avec <em>Memcached</em>. Il est aussi capable de servir n&#8217;importe quel fichier sur disque.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Voici les deux autres fichiers de configuration de Nginx : <em>proxy.conf</em> pour configurer Apache2 en proxy et fastcgi_params pour php-fpm.</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;"># /etc/nginx/proxy.conf</span><br
/> proxy_redirect &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;off;<br
/> proxy_set_header &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Host &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$host</span>;<br
/> proxy_set_header &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;X-Real-IP &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">$remote_addr</span>;<br
/> proxy_set_header &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;X-Forwarded-For &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">$proxy_add_x_forwarded_for</span>;<br
/> client_max_body_size &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;10m;<br
/> client_body_buffer_size &nbsp; &nbsp; &nbsp; &nbsp; 128k;<br
/> proxy_connect_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000;">90</span>;<br
/> proxy_send_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #000000;">90</span>;<br
/> proxy_read_timeout &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #000000;">90</span>;<br
/> proxy_buffer_size &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4k;<br
/> proxy_buffers &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000;">4</span> 32k;<br
/> proxy_busy_buffers_size &nbsp; &nbsp; &nbsp; &nbsp; 64k;<br
/> proxy_temp_file_write_size &nbsp; &nbsp; &nbsp;64k;</div></div><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;"># /etc/nginx/factcgi_params</span><br
/> fastcgi_param &nbsp;QUERY_STRING &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">$query_string</span>;<br
/> fastcgi_param &nbsp;REQUEST_METHOD &nbsp; &nbsp; <span
style="color: #007800;">$request_method</span>;<br
/> fastcgi_param &nbsp;CONTENT_TYPE &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">$content_type</span>;<br
/> fastcgi_param &nbsp;CONTENT_LENGTH &nbsp; &nbsp; <span
style="color: #007800;">$content_length</span>;<br
/> <br
/> fastcgi_param &nbsp;SCRIPT_NAME &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$fastcgi_script_name</span>;<br
/> fastcgi_param &nbsp;REQUEST_URI &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$request_uri</span>;<br
/> fastcgi_param &nbsp;DOCUMENT_URI &nbsp; &nbsp; &nbsp; <span
style="color: #007800;">$document_uri</span>;<br
/> fastcgi_param &nbsp;DOCUMENT_ROOT &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$document_root</span>;<br
/> fastcgi_param &nbsp;SERVER_PROTOCOL &nbsp; &nbsp;<span
style="color: #007800;">$server_protocol</span>;<br
/> <br
/> fastcgi_param &nbsp;GATEWAY_INTERFACE &nbsp;CGI<span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #000000;">1.1</span>;<br
/> fastcgi_param &nbsp;SERVER_SOFTWARE &nbsp; &nbsp;nginx<span
style="color: #000000; font-weight: bold;">/</span><span
style="color: #007800;">$nginx_version</span>;<br
/> <br
/> fastcgi_param &nbsp;REMOTE_ADDR &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$remote_addr</span>;<br
/> fastcgi_param &nbsp;REMOTE_PORT &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$remote_port</span>;<br
/> fastcgi_param &nbsp;SERVER_ADDR &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$server_addr</span>;<br
/> fastcgi_param &nbsp;SERVER_PORT &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$server_port</span>;<br
/> fastcgi_param &nbsp;SERVER_NAME &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #007800;">$server_name</span>;<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># PHP only, required if PHP was built with --enable-force-cgi-redirect</span><br
/> fastcgi_param &nbsp;REDIRECT_STATUS &nbsp; &nbsp;<span
style="color: #000000;">200</span>;<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># Custom settings</span><br
/> fastcgi_connect_timeout <span
style="color: #000000;">60</span>;<br
/> fastcgi_send_timeout <span
style="color: #000000;">180</span>;<br
/> fastcgi_read_timeout <span
style="color: #000000;">180</span>;<br
/> fastcgi_buffer_size 128k;<br
/> fastcgi_buffers <span
style="color: #000000;">4</span> 256k;<br
/> fastcgi_busy_buffers_size 256k;<br
/> fastcgi_temp_file_write_size 256k;<br
/> fastcgi_intercept_errors on;</div></div><p
style="text-align: justify;">Pour utiliser <em>Apache2 </em>en proxy ou <em>php-fpm</em>, il suffit d&#8217;insérer quelques lignes dans vos configurations de vhosts. C&#8217;est suffisamment détaillé ailleurs, je n&#8217;y reviendrai donc pas.</p><p
style="text-align: justify;"></p><h2>APC</h2><p
style="text-align: justify;">Voilà ma configuration APC, fonctionne bien pour Symfony. Pour certaines applis dont le code laisse à désirer, je suggère de passer le paramètre <em>include_once_override</em> à 0. Cette config provient en grande partie de chez <a
href="http://romain.cambien.net/20564234">Romain Cambien</a>.</p><div
class="codecolorer-container ini vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="ini codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #000066; font-weight:bold;"><span
style="">&#91;</span>apc<span
style="">&#93;</span></span><br
/> apc.enabled<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">1</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; 1 segments of 256Mo</span><br
/> apc.shm_segments<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">1</span><br
/> apc.shm_size<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">256</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; No optimization</span><br
/> apc.optimization<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">0</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; Never expire</span><br
/> apc.ttl<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">0</span><br
/> apc.user_ttl<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">0</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; workaround for CLI</span><br
/> apc.enable_cli<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">1</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; Symfony make lot of path lookups, try to optimize</span><br
/> apc.include_once_override<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">1</span><br
/> apc.canonicalize<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">1</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;">; Wait 2 seconds to rebuild cache</span><br
/> apc.file_update_protection<span
style="color: #000066; font-weight:bold;">=</span><span
style="color: #660066;">2</span></div></div><h2>PHP</h2><p
style="text-align: justify;">La configuration de PHP est celle par défaut aux <em>best practices</em> près (short_tags off, magic quote gpc off, &#8230;). J&#8217;ai surtout calqué sur les &laquo;&nbsp;requirements&nbsp;&raquo; de <a
href="http://diem-project.org/diem-5-0/doc/en/reference-book/requirements">Diem</a>. A noter que l&#8217;on gère 3 fichiers php.ini : pour <em>Apache2</em>, pour <em>php-fpm </em>et pour <em>cli</em>.</p><p
style="text-align: justify;"></p><h2>Memcached</h2><p
style="text-align: justify;">Aucun besoin de modifier la configuration par défaut. Par contre, on peut modifier la taille (64Mo par défaut) si besoin.</p><p
style="text-align: justify;"></p><h2>Apache2</h2><p
style="text-align: justify;">Pour utiliser Apache2 en proxy, on doit nécessairement lui attribuer un port différent du port par défaut (80). Pour cela, on modifie le fichier <em>/etc/apache2/ports.conf</em> :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;"># If you just change the port or add more ports here, you will likely also</span><br
/> <span
style="color: #666666; font-style: italic;"># have to change the VirtualHost statement in</span><br
/> <span
style="color: #666666; font-style: italic;"># /etc/apache2/sites-enabled/000-default</span><br
/> <span
style="color: #666666; font-style: italic;"># This is also true if you have upgraded from before 2.2.9-3 (i.e. from</span><br
/> <span
style="color: #666666; font-style: italic;"># Debian etch). See /usr/share/doc/apache2.2-common/NEWS.Debian.gz and</span><br
/> <span
style="color: #666666; font-style: italic;"># README.Debian.gz</span><br
/> <br
/> Listen <span
style="color: #000000;">9999</span><br
/> NameVirtualHost <span
style="color: #000000; font-weight: bold;">*</span>:<span
style="color: #000000;">9999</span><br
/> <span
style="color: #666666; font-style: italic;"># SSL name based virtual hosts are not yet supported, therefore no</span><br
/> <span
style="color: #666666; font-style: italic;"># NameVirtualHost statement here</span><br
/> Listen <span
style="color: #000000;">443</span></div></div><p
style="text-align: justify;">J&#8217;ai choisi le prefork MPM d&#8217;Apache2, la directive KeepAlive est désactivé car Apache2 ne sert que du PHP. Après quelques tests, voici la configuration retenue :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #666666; font-style: italic;"># Timeout: The number of seconds before receives and sends time out.</span><br
/> Timeout <span
style="color: #000000;">10</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># KeepAlive: Whether or not to allow persistent connections (more than</span><br
/> <span
style="color: #666666; font-style: italic;"># one request per connection). Set to &quot;Off&quot; to deactivate.</span><br
/> KeepAlive Off<br
/> <br
/> <span
style="color: #666666; font-style: italic;"># MaxKeepAliveRequests: The maximum number of requests to allow</span><br
/> <span
style="color: #666666; font-style: italic;"># during a persistent connection. Set to 0 to allow an unlimited amount.</span><br
/> <span
style="color: #666666; font-style: italic;"># We recommend you leave this number high, for maximum performance.</span><br
/> MaxKeepAliveRequests <span
style="color: #000000;">100</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># KeepAliveTimeout: Number of seconds to wait for the next request from the</span><br
/> <span
style="color: #666666; font-style: italic;"># same client on the same connection.</span><br
/> KeepAliveTimeout <span
style="color: #000000;">2</span><br
/> <br
/> <span
style="color: #666666; font-style: italic;"># prefork MPM</span><br
/> <span
style="color: #666666; font-style: italic;"># StartServers: number of server processes to start</span><br
/> <span
style="color: #666666; font-style: italic;"># MinSpareServers: minimum number of server processes which are kept spare</span><br
/> <span
style="color: #666666; font-style: italic;"># MaxSpareServers: maximum number of server processes which are kept spare</span><br
/> <span
style="color: #666666; font-style: italic;"># MaxClients: maximum number of server processes allowed to start</span><br
/> <span
style="color: #666666; font-style: italic;"># MaxRequestsPerChild: maximum number of requests a server process serves</span><br
/> StartServers &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span
style="color: #000000;">8</span><br
/> MinSpareServers &nbsp; &nbsp; &nbsp; <span
style="color: #000000;">5</span><br
/> MaxSpareServers &nbsp; &nbsp; &nbsp;<span
style="color: #000000;">15</span><br
/> MaxClients &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span
style="color: #000000;">80</span><br
/> MaxRequestsPerChild &nbsp; <span
style="color: #000000;">0</span></div></div><h2>MySQL</h2><p
style="text-align: justify;">En SGBD, j&#8217;ai installé MySQL et <a
href="http://www.postgresql.org/">PostgreSQL</a> qui ne sert pas pour le moment. La configuration MySQL est d&#8217;origine à l&#8217;exception d&#8217;un Ramdisk pour le répertoire temporaire. L&#8217;explication pour la création d&#8217;un Ramdisk est expliqué ici : <a
href="http://www.willdurand.fr/optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2/">http://www.willdurand.fr/optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2/</a>. MySQL est également protégé par une couche Memcached, ce qui permet de faire tenir une charge correcte sans envoyer MySQL dans les choux.</p><p
style="text-align: justify;"></p><h2>Postfix</h2><p
style="text-align: justify;">Configuré en &laquo;&nbsp;Site Internet&nbsp;&raquo;, rien n&#8217;a été touché et les mails transitent bien. Je n&#8217;ai pas besoin de faire de gestion de mail autre.</p><p
style="text-align: justify;"></p><h2>Getmail</h2><p
style="text-align: justify;">Dernière petite chose qui n&#8217;avait pas été relevé dans l&#8217;article précédent : <a
href="http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/">http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/</a>, la sauvegarde de mes emails. Tout est dit <a
href="http://maxime.sh/2010/06/sauvegarder-son-gmail-grace-a-linux/">ici</a>. J&#8217;envoie toutes mes sauvegardes sur un autre serveur privé et inaccessible excepté le temps du transfert.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Voilà.</p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2/' title='Optimiser son application web en jouant sur PHP, MySQL et Apache2'>Optimiser son application web en jouant sur PHP, MySQL et Apache2</a></li><li><a
href='http://www.willdurand.fr/replication-mysql-maitre-esclave/' title='Réplication MySQL maître-esclave'>Réplication MySQL maître-esclave</a></li><li><a
href='http://www.willdurand.fr/creation-automatique-dun-projet-symfony-mysql-git-et-apache2/' title='Création automatique d&#8217;un projet symfony + MySQL + Git et Apache2'>Création automatique d&#8217;un projet symfony + MySQL + Git et Apache2</a></li><li><a
href='http://www.willdurand.fr/lerreur-suexec-policy-violation-avec-symfony-chez-ovh/' title='L&#8217;erreur &laquo;&nbsp;suexec policy violation&nbsp;&raquo; avec symfony (chez OVH&#8230;)'>L&#8217;erreur &laquo;&nbsp;suexec policy violation&nbsp;&raquo; avec symfony (chez OVH&#8230;)</a></li><li><a
href='http://www.willdurand.fr/sauvegarde-incrementale-avec-rsync-fichiers-et-base-de-donnees-mysql/' title='Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL'>Sauvegarde incrémentale avec rsync : fichiers et base de données MySQL</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;bodytext=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;notes=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;t=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL%20-%20http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;annotation=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;t=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;body=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&title=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Fdedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql%2F&amp;submitHeadline=D%C3%A9dibox%20v3%20%3A%20Nginx%20%2B%20PHP-FPM%20%2B%20Apache2%20%2B%20APC%20%2B%20Memcached%20%2B%20MySQL&amp;submitSummary=Bonjour%20%3A-%29%0D%0AJ%27ai%20r%C3%A9cemment%20pris%20une%20D%C3%A9dibox%20v3%20et%20pour%20le%20moment%20j%27en%20suis%20tr%C3%A8s%20satisfait.%20On%20m%27a%20pas%20mal%20sollicit%C3%A9%20ces%20derniers%20temps%20pour%20que%20j%27explique%20comment%20j%27ai%20configur%C3%A9%20ce%20serveur%20ainsi%20que%20les%20services%20que%20j%27ai%20pu%20mettre%20en%20place.%20C%27e&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Optimiser son application web en jouant sur PHP, MySQL et Apache2</title><link>http://www.willdurand.fr/optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2</link> <comments>http://www.willdurand.fr/optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2/#comments</comments> <pubDate>Wed, 25 Nov 2009 14:14:32 +0000</pubDate> <dc:creator>Will</dc:creator> <category><![CDATA[Ancien blog]]></category> <category><![CDATA[Apache2]]></category> <category><![CDATA[APC]]></category> <category><![CDATA[Memcached]]></category> <category><![CDATA[MySQL]]></category> <category><![CDATA[PECL]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Ramdisk]]></category><guid
isPermaLink="false"></guid> <description><![CDATA[Après avoir bien optimisé toute la partie frontend de mon site au sens HTML, CSS, JavaScript, etc, je me suis penché sur les aspects plus techniques et technologiques. Je parlerai donc de PHP, de MySQL, de serveur Apache2, de Memcached, d’Opcode mais aussi d’architecture applicative. Pour pouvoir travailler dans de bonnes conditions j’ai loué un [...]]]></description> <content:encoded><![CDATA[<p
style="text-align: justify;"></p><p
style="text-align: justify;">Après avoir bien optimisé toute la partie <span
style="text-decoration: underline;">frontend</span> de mon site au sens <span
style="text-decoration: underline;">HTML</span>, <span
style="text-decoration: underline;">CSS</span>, <span
style="text-decoration: underline;">JavaScript</span>, etc, je me suis penché sur les <strong>aspects plus techniques et technologiques</strong>. Je parlerai donc de <strong>PHP</strong>, de <strong>MySQL</strong>, de serveur <strong>Apache2</strong>, de <strong>Memcached</strong>, d’<strong>Opcode</strong> mais aussi d’<strong>architecture applicative</strong>.</p><p
style="text-align: justify;">Pour pouvoir travailler dans de bonnes conditions j’ai loué un <strong>serveur dédié virtuel</strong> (VPS) chez <em>Gandi</em>. L’offre actuelle est composée de <strong>parts</strong>, une part représentant environ 1/60ème d’un gros serveur. J’ai choisi ce type de serveur car je n’ai pas réellement besoin d’un full dédié mais aussi pour l’<strong>architecture scalable</strong> fourni. En effet, il est possible de rajouter des parts à la volée, ponctuellement ou de manière programmée. On peut ainsi pallier une grosse surcharge automatiquement même si le temps de déclenchement est trop élevé (dépassement du seuil défini pendant 20 minutes au moins).</p><p
style="text-align: justify;"></p><h2>Installation et configuration</h2><p
style="text-align: justify;">J’ai donc pris <span
style="text-decoration: underline;">une part</span>, vierge de toute installation à l’exception de la distribution Linux, <span
style="text-decoration: underline;">Debian 5</span> dans mon cas. J’ai commencé par installer les services web utiles : <span
style="text-decoration: underline;">Apache2</span>, <span
style="text-decoration: underline;">MySQL</span>, <span
style="text-decoration: underline;">PHP 5.3</span> et <span
style="text-decoration: underline;">PhpMyAdmin</span>. Ensuite, j’ai installé <strong>APC</strong> via la commande <strong>PECL</strong> (<span
style="text-decoration: underline;">pour PHP 5.3 on veillera à bien prendre <em>apc-beta</em></span>). J’ai également installé <strong>Memcached</strong> et l’<span
style="text-decoration: underline;">extension qui va bien pour l’utiliser avec PHP</span>. Je passe les aspects configurations de sécurité du serveur en lui-même mais voilà ce que j’ai fait pour chaque application :</p><h3>Apache2</h3><p
style="text-align: justify;">Niveau configuration, rien n’a été modifié mis à part les vhosts et un paramètre dont je donnerai les détails plus bas. Du côté des modules, j’ai installé ceux qui vont bien : <strong>deflate</strong>,<strong>expires</strong>, <strong>headers</strong>, <strong>mem_cache</strong>, <strong>rewrite</strong> et <strong>php5</strong>.</p><h3>MySQL</h3><p
style="text-align: justify;">Aucune modification, sauf l’activation des logs lors des phases de test. Pour cela, on modifie le fichier <em>my.cnf</em> dans <em>/etc/mysql/</em>.</p><h3>APC</h3><p
style="text-align: justify;">Il faut l’activer dans le fichier <em>php.ini</em> :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #007800;">extension</span>=apc.so</div></div><p
style="text-align: justify;">Puis le configurer :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span
style="color: #7a0874; font-weight: bold;">&#91;</span>APC<span
style="color: #7a0874; font-weight: bold;">&#93;</span><br
/> apc.enabled=<span
style="color: #000000;">1</span><br
/> apc.stat=<span
style="color: #000000;">0</span><br
/> apc.mmap_file_mask = <span
style="color: #000000; font-weight: bold;">/</span>media<span
style="color: #000000; font-weight: bold;">/</span>ramdisk1<span
style="color: #000000; font-weight: bold;">/</span>apc.XXXXXX</div></div><p
style="text-align: justify;"><div
class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">apc.stat=0</div></div>Permet d’éviter les appels disque.</p><p
style="text-align: justify;"><div
class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">apc.mmap_file_mask = /media/ramdisk1/apc.XXXXXX</div></div>Définit l’endroit où sont stockés les fichiers de cache. Ici j’utilise un <strong>Ramdisk de 32Mo</strong> même si ce n’est pas forcément utile car APC utilise de base un segment de mémoire partagé. <span
style="text-decoration: underline;">A voir plus bas une note à ce sujet</span>.</p><p
style="text-align: justify;">Pour <strong>créer un Ramdisk</strong>, il faut utiliser le système de fichier <strong>tmpfs</strong>. Un exemple de ligne à insérer dans <em>/etc/fstab</em> :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tmpfs <span
style="color: #000000; font-weight: bold;">/</span>media<span
style="color: #000000; font-weight: bold;">/</span>ramdisk1 tmpfs defaults,<span
style="color: #007800;">size</span>=8M <span
style="color: #000000;">0</span> <span
style="color: #000000;">0</span></div></div><h3>Memcached</h3><p
style="text-align: justify;">On ne touche à rien excepté la taille alloué que j’ai passé de <strong>32Mo à 16Mo</strong> : suffisant et avec 256Mo de base, le mieux est de se restreindre.</p><p
style="text-align: justify;"></p><h2>Phases de tests</h2><p
style="text-align: justify;">Avec tout ceci, j’ai pu faire des tests et voir ce que permettait un tel serveur. J’ai fait des <strong>Apache Bench</strong> (ab) de plusieurs manières. Les premiers n’ont pas été glorieux, un simple ab 200/5 donnait <span
style="text-decoration: underline;">moins de 2 requêtes par seconde</span>. Très mauvais du coup. De ce fait, trois pistes :</p><p
style="text-align: justify;">- Problème matériel : CPU trop faible, RAM insuffisante, lenteurs des accès disques.</p><p
style="text-align: justify;">- Problème logiciel : Apache2 mal configuré, MySQL saturé.</p><p
style="text-align: justify;">- Problème sur l’application en elle-même.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;"><strong>Point numéro 1 :</strong> Via <a
href="http://twitter.com/mrboo">@mrboo</a>, je savais à quoi m’attendre et comme je n’ai pas le choix, je dois me contenter de ce que j’ai et l’optimiser. (Je fais le choix de tester une part unique). Au niveau des accès disques, ce type de serveur obtient de bons scores. Puis un simple htop me montrait bien qu’il se passait quelque chose ailleurs.</p><p
style="text-align: justify;"><strong>Point numéro 2 :</strong> <strong>MySQL</strong> est en quelques sortes protégé par <strong>Memcached</strong> puisque ce dernier stocke les résultats des <span
style="text-decoration: underline;">requêtes SQL</span> pendant un certain temps <em>t</em>. Ce n’est pas là que ce situe le problème.</p><p
style="text-align: justify;">Au niveau d’<strong>Apache2</strong>, j’ai modifié le paramètre <strong>KeepAlive</strong> en le positionnant à <strong>Off</strong>. Ce changement m’a permis de gagner énormément et d’obtenir des résultats convenables.</p><p
style="text-align: justify;"><strong>Point numéro 3 :</strong> Au niveau de mon application j’ai repensé la couche d’accès aux données. En effet, j’avais dans un premier temps ajouté le cache Memcached à PDO. C’est un tord puisque les connexions se faisaient toujours (même si derrière, aucune requête n’était exécutée). C’est pourquoi j’ai modifié ce petit point en testant d’abord l’existance de résultats dans le cache et cas échéant en ouvrant ensuite une connexion à la base de données et en intérrogeant MySQL.</p><p
style="text-align: justify;">Memcached fonctionne sur un <strong>système clé/valeur</strong> : je stocke le <strong>hash md5 de la requête SQL</strong><strong> et son résultat correspondant</strong>, j’ai également pris soin d’utiliser la <strong>compression</strong>Memcached disponible.</p><p
style="text-align: justify;">De plus, j’ai optimisé mes requêtes SQL ainsi que mes tables de base de données.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Après de tels changements voici les résultats obtenus :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">will-serv:~<span
style="color: #666666; font-style: italic;"># ab -n 500 -c 70 http://localhost/willdurand/</span><br
/> <br
/> This is ApacheBench, Version <span
style="color: #000000;">2.3</span> <span
style="color: #000000; font-weight: bold;">&lt;</span><span
style="color: #007800;">$Revision</span>: <span
style="color: #000000;">655654</span> $<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <br
/> Copyright <span
style="color: #000000;">1996</span> Adam Twiss, Zeus Technology Ltd, http:<span
style="color: #000000; font-weight: bold;">//</span>www.zeustech.net<span
style="color: #000000; font-weight: bold;">/</span><br
/> <br
/> Licensed to The Apache Software Foundation, http:<span
style="color: #000000; font-weight: bold;">//</span>www.apache.org<span
style="color: #000000; font-weight: bold;">/</span><br
/> <br
/> Benchmarking localhost <span
style="color: #7a0874; font-weight: bold;">&#40;</span>be patient<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> Completed <span
style="color: #000000;">100</span> requests<br
/> <br
/> Completed <span
style="color: #000000;">200</span> requests<br
/> <br
/> Completed <span
style="color: #000000;">300</span> requests<br
/> <br
/> Completed <span
style="color: #000000;">400</span> requests<br
/> <br
/> Completed <span
style="color: #000000;">500</span> requests<br
/> <br
/> Finished <span
style="color: #000000;">500</span> requests<br
/> <br
/> Server Software: Apache<span
style="color: #000000; font-weight: bold;">/</span>2.2.9<br
/> <br
/> Server Hostname: localhost<br
/> <br
/> Server Port: <span
style="color: #000000;">80</span><br
/> <br
/> Document Path: <span
style="color: #000000; font-weight: bold;">/</span>willdurand<span
style="color: #000000; font-weight: bold;">/</span><br
/> <br
/> Document Length: <span
style="color: #000000;">38360</span> bytes<br
/> <br
/> Concurrency Level: <span
style="color: #000000;">70</span><br
/> <br
/> Time taken <span
style="color: #000000; font-weight: bold;">for</span> tests: <span
style="color: #000000;">136.806</span> seconds<br
/> <br
/> Complete requests: <span
style="color: #000000;">500</span><br
/> <br
/> Failed requests: <span
style="color: #000000;">0</span><br
/> <br
/> Write errors: <span
style="color: #000000;">0</span><br
/> <br
/> Total transferred: <span
style="color: #000000;">19376000</span> bytes<br
/> <br
/> HTML transferred: <span
style="color: #000000;">19180000</span> bytes<br
/> <br
/> Requests per second: <span
style="color: #000000;">3.65</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span><span
style="color: #666666; font-style: italic;">#/sec] (mean)</span><br
/> <br
/> Time per request: <span
style="color: #000000;">19152.871</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> Time per request: <span
style="color: #000000;">273.612</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> Transfer rate: <span
style="color: #000000;">138.31</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span
style="color: #000000; font-weight: bold;">/</span>sec<span
style="color: #7a0874; font-weight: bold;">&#93;</span> received<br
/> <br
/> Connection Times <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> min mean<span
style="color: #7a0874; font-weight: bold;">&#91;</span>+<span
style="color: #000000; font-weight: bold;">/</span>-sd<span
style="color: #7a0874; font-weight: bold;">&#93;</span> median max<br
/> <br
/> Connect: <span
style="color: #000000;">0</span> <span
style="color: #000000;">1</span> <span
style="color: #000000;">5.7</span> <span
style="color: #000000;">0</span> <span
style="color: #000000;">90</span><br
/> <br
/> Processing: <span
style="color: #000000;">98</span> <span
style="color: #000000;">17651</span> <span
style="color: #000000;">29364.9</span> <span
style="color: #000000;">310</span> <span
style="color: #000000;">127048</span><br
/> <br
/> Waiting: <span
style="color: #000000;">97</span> <span
style="color: #000000;">16805</span> <span
style="color: #000000;">28446.2</span> <span
style="color: #000000;">284</span> <span
style="color: #000000;">126923</span><br
/> <br
/> Total: <span
style="color: #000000;">99</span> <span
style="color: #000000;">17651</span> <span
style="color: #000000;">29364.9</span> <span
style="color: #000000;">310</span> <span
style="color: #000000;">127048</span><br
/> <br
/> Percentage of the requests served within a certain <span
style="color: #000000; font-weight: bold;">time</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> <span
style="color: #000000;">50</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">310</span><br
/> <br
/> <span
style="color: #000000;">66</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">7322</span><br
/> <br
/> <span
style="color: #000000;">75</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">25825</span><br
/> <br
/> <span
style="color: #000000;">80</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">41547</span><br
/> <br
/> <span
style="color: #000000;">90</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">64293</span><br
/> <br
/> <span
style="color: #000000;">95</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">89797</span><br
/> <br
/> <span
style="color: #000000;">98</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">101118</span><br
/> <br
/> <span
style="color: #000000;">99</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">101982</span><br
/> <br
/> <span
style="color: #000000;">100</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">127048</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>longest request<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> will-serv:~<span
style="color: #666666; font-style: italic;">#</span></div></div><p
style="text-align: justify;">200 requêtes, 1 en concurence : <strong>6,97</strong> requêtes par seconde.</p><p
style="text-align: justify;">200 requêtes, 5 en concurence : <strong>6,65</strong> requêtes par seconde.</p><p
style="text-align: justify;">A ce niveau là, le serveur encaisse bien (du moins à mon échelle).</p><p
style="text-align: justify;"></p><h2>Ramdisk or not Ramdisk avec APC</h2><p
style="text-align: justify;">Au niveau d’<strong>APC</strong> j’ai testé l’utilisation d’un Ramdisk :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">will-serv:~<span
style="color: #666666; font-style: italic;"># ab -n 500 -c 70 http://localhost/willdurand/</span><br
/> <br
/> This is ApacheBench, Version <span
style="color: #000000;">2.3</span> <span
style="color: #000000; font-weight: bold;">&lt;</span><span
style="color: #007800;">$Revision</span>: <span
style="color: #000000;">655654</span> $<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <br
/> Copyright <span
style="color: #000000;">1996</span> Adam Twiss, Zeus Technology Ltd, http:<span
style="color: #000000; font-weight: bold;">//</span>www.zeustech.net<span
style="color: #000000; font-weight: bold;">/</span><br
/> <br
/> Licensed to The Apache Software Foundation, http:<span
style="color: #000000; font-weight: bold;">//</span>www.apache.org<span
style="color: #000000; font-weight: bold;">/</span><br
/> <br
/> Benchmarking localhost <span
style="color: #7a0874; font-weight: bold;">&#40;</span>be patient<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> Completed <span
style="color: #000000;">100</span> requests<br
/> <br
/> Completed <span
style="color: #000000;">200</span> requests<br
/> <br
/> Completed <span
style="color: #000000;">300</span> requests<br
/> <br
/> Completed <span
style="color: #000000;">400</span> requests<br
/> <br
/> Completed <span
style="color: #000000;">500</span> requests<br
/> <br
/> Finished <span
style="color: #000000;">500</span> requests<br
/> <br
/> Server Software: Apache<span
style="color: #000000; font-weight: bold;">/</span>2.2.9<br
/> <br
/> Server Hostname: localhost<br
/> <br
/> Server Port: <span
style="color: #000000;">80</span><br
/> <br
/> Document Path: <span
style="color: #000000; font-weight: bold;">/</span>willdurand<span
style="color: #000000; font-weight: bold;">/</span><br
/> <br
/> Document Length: <span
style="color: #000000;">38360</span> bytes<br
/> <br
/> Concurrency Level: <span
style="color: #000000;">70</span><br
/> <br
/> Time taken <span
style="color: #000000; font-weight: bold;">for</span> tests: <span
style="color: #000000;">93.212</span> seconds<br
/> <br
/> Complete requests: <span
style="color: #000000;">500</span><br
/> <br
/> Failed requests: <span
style="color: #000000;">1</span><br
/> <br
/> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>Connect: <span
style="color: #000000;">0</span>, Receive: <span
style="color: #000000;">0</span>, Length: <span
style="color: #000000;">1</span>, Exceptions: <span
style="color: #000000;">0</span><span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> Write errors: <span
style="color: #000000;">0</span><br
/> <br
/> Total transferred: <span
style="color: #000000;">19376074</span> bytes<br
/> <br
/> HTML transferred: <span
style="color: #000000;">19180074</span> bytes<br
/> <br
/> Requests per second: <span
style="color: #000000;">5.36</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span><span
style="color: #666666; font-style: italic;">#/sec] (mean)</span><br
/> <br
/> Time per request: <span
style="color: #000000;">13049.644</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> Time per request: <span
style="color: #000000;">186.423</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> Transfer rate: <span
style="color: #000000;">203.00</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span
style="color: #000000; font-weight: bold;">/</span>sec<span
style="color: #7a0874; font-weight: bold;">&#93;</span> received<br
/> <br
/> Connection Times <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> min mean<span
style="color: #7a0874; font-weight: bold;">&#91;</span>+<span
style="color: #000000; font-weight: bold;">/</span>-sd<span
style="color: #7a0874; font-weight: bold;">&#93;</span> median max<br
/> <br
/> Connect: <span
style="color: #000000;">0</span> <span
style="color: #000000;">372</span> <span
style="color: #000000;">957.7</span> <span
style="color: #000000;">0</span> <span
style="color: #000000;">2886</span><br
/> <br
/> Processing: <span
style="color: #000000;">121</span> <span
style="color: #000000;">12005</span> <span
style="color: #000000;">19024.4</span> <span
style="color: #000000;">3701</span> <span
style="color: #000000;">90325</span><br
/> <br
/> Waiting: <span
style="color: #000000;">96</span> <span
style="color: #000000;">11847</span> <span
style="color: #000000;">18792.4</span> <span
style="color: #000000;">3581</span> <span
style="color: #000000;">90296</span><br
/> <br
/> Total: <span
style="color: #000000;">121</span> <span
style="color: #000000;">12376</span> <span
style="color: #000000;">19328.5</span> <span
style="color: #000000;">4002</span> <span
style="color: #000000;">93211</span><br
/> <br
/> Percentage of the requests served within a certain <span
style="color: #000000; font-weight: bold;">time</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> <span
style="color: #000000;">50</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">4002</span><br
/> <br
/> <span
style="color: #000000;">66</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">8782</span><br
/> <br
/> <span
style="color: #000000;">75</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">14842</span><br
/> <br
/> <span
style="color: #000000;">80</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">17808</span><br
/> <br
/> <span
style="color: #000000;">90</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">38836</span><br
/> <br
/> <span
style="color: #000000;">95</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">57641</span><br
/> <br
/> <span
style="color: #000000;">98</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">81943</span><br
/> <br
/> <span
style="color: #000000;">99</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">92179</span><br
/> <br
/> <span
style="color: #000000;">100</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">93211</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>longest request<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> will-serv:~<span
style="color: #666666; font-style: italic;">#</span></div></div><p
style="text-align: justify;">Puis l&#8217;utilisation sans <strong>Ramdisk</strong> par <strong>APC</strong>. Le résultat est meilleur :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">will-serv:~<span
style="color: #666666; font-style: italic;"># ab -n 200 -c 1 http://localhost/willdurand/</span><br
/> <br
/> This is ApacheBench, Version <span
style="color: #000000;">2.3</span> <span
style="color: #000000; font-weight: bold;">&lt;</span><span
style="color: #007800;">$Revision</span>: <span
style="color: #000000;">655654</span> $<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> <br
/> Copyright <span
style="color: #000000;">1996</span> Adam Twiss, Zeus Technology Ltd, http:<span
style="color: #000000; font-weight: bold;">//</span>www.zeustech.net<span
style="color: #000000; font-weight: bold;">/</span><br
/> <br
/> Licensed to The Apache Software Foundation, http:<span
style="color: #000000; font-weight: bold;">//</span>www.apache.org<span
style="color: #000000; font-weight: bold;">/</span><br
/> <br
/> Benchmarking localhost <span
style="color: #7a0874; font-weight: bold;">&#40;</span>be patient<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> Completed <span
style="color: #000000;">100</span> requests<br
/> <br
/> Completed <span
style="color: #000000;">200</span> requests<br
/> <br
/> Finished <span
style="color: #000000;">200</span> requests<br
/> <br
/> Server Software: Apache<span
style="color: #000000; font-weight: bold;">/</span>2.2.9<br
/> <br
/> Server Hostname: localhost<br
/> <br
/> Server Port: <span
style="color: #000000;">80</span><br
/> <br
/> Document Path: <span
style="color: #000000; font-weight: bold;">/</span>willdurand<span
style="color: #000000; font-weight: bold;">/</span><br
/> <br
/> Document Length: <span
style="color: #000000;">38364</span> bytes<br
/> <br
/> Concurrency Level: <span
style="color: #000000;">1</span><br
/> <br
/> Time taken <span
style="color: #000000; font-weight: bold;">for</span> tests: <span
style="color: #000000;">28.705</span> seconds<br
/> <br
/> Complete requests: <span
style="color: #000000;">200</span><br
/> <br
/> Failed requests: <span
style="color: #000000;">0</span><br
/> <br
/> Write errors: <span
style="color: #000000;">0</span><br
/> <br
/> Total transferred: <span
style="color: #000000;">7751200</span> bytes<br
/> <br
/> HTML transferred: <span
style="color: #000000;">7672800</span> bytes<br
/> <br
/> Requests per second: <span
style="color: #000000;">6.97</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span><span
style="color: #666666; font-style: italic;">#/sec] (mean)</span><br
/> <br
/> Time per request: <span
style="color: #000000;">143.523</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> Time per request: <span
style="color: #000000;">143.523</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> Transfer rate: <span
style="color: #000000;">263.70</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span
style="color: #000000; font-weight: bold;">/</span>sec<span
style="color: #7a0874; font-weight: bold;">&#93;</span> received<br
/> <br
/> Connection Times <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> min mean<span
style="color: #7a0874; font-weight: bold;">&#91;</span>+<span
style="color: #000000; font-weight: bold;">/</span>-sd<span
style="color: #7a0874; font-weight: bold;">&#93;</span> median max<br
/> <br
/> Connect: <span
style="color: #000000;">0</span> <span
style="color: #000000;">0</span> <span
style="color: #000000;">6.4</span> <span
style="color: #000000;">0</span> <span
style="color: #000000;">90</span><br
/> <br
/> Processing: <span
style="color: #000000;">121</span> <span
style="color: #000000;">143</span> <span
style="color: #000000;">33.6</span> <span
style="color: #000000;">124</span> <span
style="color: #000000;">275</span><br
/> <br
/> Waiting: <span
style="color: #000000;">29</span> <span
style="color: #000000;">136</span> <span
style="color: #000000;">29.7</span> <span
style="color: #000000;">121</span> <span
style="color: #000000;">273</span><br
/> <br
/> Total: <span
style="color: #000000;">121</span> <span
style="color: #000000;">143</span> <span
style="color: #000000;">34.3</span> <span
style="color: #000000;">124</span> <span
style="color: #000000;">275</span><br
/> <br
/> Percentage of the requests served within a certain <span
style="color: #000000; font-weight: bold;">time</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> <span
style="color: #000000;">50</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">124</span><br
/> <br
/> <span
style="color: #000000;">66</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">151</span><br
/> <br
/> <span
style="color: #000000;">75</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">151</span><br
/> <br
/> <span
style="color: #000000;">80</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">152</span><br
/> <br
/> <span
style="color: #000000;">90</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">181</span><br
/> <br
/> <span
style="color: #000000;">95</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">241</span><br
/> <br
/> <span
style="color: #000000;">98</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">249</span><br
/> <br
/> <span
style="color: #000000;">99</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">271</span><br
/> <br
/> <span
style="color: #000000;">100</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">275</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>longest request<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <br
/> will-serv:~<span
style="color: #666666; font-style: italic;">#</span></div></div><p
style="text-align: justify;">On utilisera donc un <strong>Ramdisk</strong> avec les <strong>Opcodes</strong> type <strong>eAccelerator</strong> mais <span
style="text-decoration: underline;">pas avec APC</span>. Après réglage de ces détails, le serveur passe la barre de 7 requêtes par seconde avec des temps de réponse assez plaisants :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">will-serv:~<span
style="color: #666666; font-style: italic;"># ab -n 200 -c 1 http://localhost/willdurand/</span><br
/> This is ApacheBench, Version <span
style="color: #000000;">2.3</span> <span
style="color: #000000; font-weight: bold;">&lt;</span><span
style="color: #007800;">$Revision</span>: <span
style="color: #000000;">655654</span> $<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> Copyright <span
style="color: #000000;">1996</span> Adam Twiss, Zeus Technology Ltd, http:<span
style="color: #000000; font-weight: bold;">//</span>www.zeustech.net<span
style="color: #000000; font-weight: bold;">/</span><br
/> Licensed to The Apache Software Foundation, http:<span
style="color: #000000; font-weight: bold;">//</span>www.apache.org<span
style="color: #000000; font-weight: bold;">/</span><br
/> Benchmarking localhost <span
style="color: #7a0874; font-weight: bold;">&#40;</span>be patient<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> Completed <span
style="color: #000000;">100</span> requests<br
/> Completed <span
style="color: #000000;">200</span> requests<br
/> Finished <span
style="color: #000000;">200</span> requests<br
/> Server Software: Apache<span
style="color: #000000; font-weight: bold;">/</span>2.2.9<br
/> Server Hostname: localhost<br
/> Server Port: <span
style="color: #000000;">80</span><br
/> Document Path: <span
style="color: #000000; font-weight: bold;">/</span>willdurand<span
style="color: #000000; font-weight: bold;">/</span><br
/> Document Length: <span
style="color: #000000;">38360</span> bytes<br
/> Concurrency Level: <span
style="color: #000000;">1</span><br
/> Time taken <span
style="color: #000000; font-weight: bold;">for</span> tests: <span
style="color: #000000;">28.513</span> seconds<br
/> Complete requests: <span
style="color: #000000;">200</span><br
/> Failed requests: <span
style="color: #000000;">0</span><br
/> Write errors: <span
style="color: #000000;">0</span><br
/> Total transferred: <span
style="color: #000000;">7750400</span> bytes<br
/> HTML transferred: <span
style="color: #000000;">7672000</span> bytes<br
/> Requests per second: <span
style="color: #000000;">7.01</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span><span
style="color: #666666; font-style: italic;">#/sec] (mean)</span><br
/> Time per request: <span
style="color: #000000;">142.563</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> Time per request: <span
style="color: #000000;">142.563</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> Transfer rate: <span
style="color: #000000;">265.45</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span
style="color: #000000; font-weight: bold;">/</span>sec<span
style="color: #7a0874; font-weight: bold;">&#93;</span> received<br
/> Connection Times <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> min mean<span
style="color: #7a0874; font-weight: bold;">&#91;</span>+<span
style="color: #000000; font-weight: bold;">/</span>-sd<span
style="color: #7a0874; font-weight: bold;">&#93;</span> median max<br
/> Connect: <span
style="color: #000000;">0</span> <span
style="color: #000000;">0</span> <span
style="color: #000000;">0.0</span> <span
style="color: #000000;">0</span> <span
style="color: #000000;">0</span><br
/> Processing: <span
style="color: #000000;">33</span> <span
style="color: #000000;">142</span> <span
style="color: #000000;">36.4</span> <span
style="color: #000000;">124</span> <span
style="color: #000000;">279</span><br
/> Waiting: <span
style="color: #000000;">28</span> <span
style="color: #000000;">133</span> <span
style="color: #000000;">25.0</span> <span
style="color: #000000;">122</span> <span
style="color: #000000;">278</span><br
/> Total: <span
style="color: #000000;">33</span> <span
style="color: #000000;">143</span> <span
style="color: #000000;">36.4</span> <span
style="color: #000000;">124</span> <span
style="color: #000000;">279</span><br
/> Percentage of the requests served within a certain <span
style="color: #000000; font-weight: bold;">time</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <span
style="color: #000000;">50</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">124</span><br
/> <span
style="color: #000000;">66</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">152</span><br
/> <span
style="color: #000000;">75</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">152</span><br
/> <span
style="color: #000000;">80</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">153</span><br
/> <span
style="color: #000000;">90</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">184</span><br
/> <span
style="color: #000000;">95</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">243</span><br
/> <span
style="color: #000000;">98</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">246</span><br
/> <span
style="color: #000000;">99</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">274</span><br
/> <span
style="color: #000000;">100</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">279</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>longest request<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> will-serv:~<span
style="color: #666666; font-style: italic;">#</span></div></div><p
style="text-align: justify;">Toujours mieux avec 5 requêtes concurrentes :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">will-serv:~<span
style="color: #666666; font-style: italic;"># ab -n 200 -c 5 http://localhost/willdurand/</span><br
/> This is ApacheBench, Version <span
style="color: #000000;">2.3</span> <span
style="color: #000000; font-weight: bold;">&lt;</span><span
style="color: #007800;">$Revision</span>: <span
style="color: #000000;">655654</span> $<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> Copyright <span
style="color: #000000;">1996</span> Adam Twiss, Zeus Technology Ltd, http:<span
style="color: #000000; font-weight: bold;">//</span>www.zeustech.net<span
style="color: #000000; font-weight: bold;">/</span><br
/> Licensed to The Apache Software Foundation, http:<span
style="color: #000000; font-weight: bold;">//</span>www.apache.org<span
style="color: #000000; font-weight: bold;">/</span><br
/> Benchmarking localhost <span
style="color: #7a0874; font-weight: bold;">&#40;</span>be patient<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> Completed <span
style="color: #000000;">100</span> requests<br
/> Completed <span
style="color: #000000;">200</span> requests<br
/> Finished <span
style="color: #000000;">200</span> requests<br
/> Server Software: Apache<span
style="color: #000000; font-weight: bold;">/</span>2.2.9<br
/> Server Hostname: localhost<br
/> Server Port: <span
style="color: #000000;">80</span><br
/> Document Path: <span
style="color: #000000; font-weight: bold;">/</span>willdurand<span
style="color: #000000; font-weight: bold;">/</span><br
/> Document Length: <span
style="color: #000000;">38360</span> bytes<br
/> Concurrency Level: <span
style="color: #000000;">5</span><br
/> Time taken <span
style="color: #000000; font-weight: bold;">for</span> tests: <span
style="color: #000000;">29.581</span> seconds<br
/> Complete requests: <span
style="color: #000000;">200</span><br
/> Failed requests: <span
style="color: #000000;">0</span><br
/> Write errors: <span
style="color: #000000;">0</span><br
/> Total transferred: <span
style="color: #000000;">7750400</span> bytes<br
/> HTML transferred: <span
style="color: #000000;">7672000</span> bytes<br
/> Requests per second: <span
style="color: #000000;">6.76</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span><span
style="color: #666666; font-style: italic;">#/sec] (mean)</span><br
/> Time per request: <span
style="color: #000000;">739.524</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> Time per request: <span
style="color: #000000;">147.905</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> Transfer rate: <span
style="color: #000000;">255.87</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span
style="color: #000000; font-weight: bold;">/</span>sec<span
style="color: #7a0874; font-weight: bold;">&#93;</span> received<br
/> Connection Times <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> min mean<span
style="color: #7a0874; font-weight: bold;">&#91;</span>+<span
style="color: #000000; font-weight: bold;">/</span>-sd<span
style="color: #7a0874; font-weight: bold;">&#93;</span> median max<br
/> Connect: <span
style="color: #000000;">0</span> <span
style="color: #000000;">1</span> <span
style="color: #000000;">8.6</span> <span
style="color: #000000;">0</span> <span
style="color: #000000;">120</span><br
/> Processing: <span
style="color: #000000;">121</span> <span
style="color: #000000;">736</span> <span
style="color: #000000;">614.0</span> <span
style="color: #000000;">659</span> <span
style="color: #000000;">7590</span><br
/> Waiting: <span
style="color: #000000;">120</span> <span
style="color: #000000;">731</span> <span
style="color: #000000;">609.4</span> <span
style="color: #000000;">658</span> <span
style="color: #000000;">7498</span><br
/> Total: <span
style="color: #000000;">121</span> <span
style="color: #000000;">737</span> <span
style="color: #000000;">613.9</span> <span
style="color: #000000;">659</span> <span
style="color: #000000;">7590</span><br
/> Percentage of the requests served within a certain <span
style="color: #000000; font-weight: bold;">time</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <span
style="color: #000000;">50</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">659</span><br
/> <span
style="color: #000000;">66</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">766</span><br
/> <span
style="color: #000000;">75</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">789</span><br
/> <span
style="color: #000000;">80</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">829</span><br
/> <span
style="color: #000000;">90</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">959</span><br
/> <span
style="color: #000000;">95</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">1064</span><br
/> <span
style="color: #000000;">98</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">1849</span><br
/> <span
style="color: #000000;">99</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">4688</span><br
/> <span
style="color: #000000;">100</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">7590</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>longest request<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> will-serv:~<span
style="color: #666666; font-style: italic;">#</span></div></div><p
style="text-align: justify;">Ensuite dans les benchs plus importants :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">will-serv:~<span
style="color: #666666; font-style: italic;"># ab -n 500 -c 50 http://localhost/willdurand/</span><br
/> This is ApacheBench, Version <span
style="color: #000000;">2.3</span> <span
style="color: #000000; font-weight: bold;">&lt;</span><span
style="color: #007800;">$Revision</span>: <span
style="color: #000000;">655654</span> $<span
style="color: #000000; font-weight: bold;">&gt;</span><br
/> Copyright <span
style="color: #000000;">1996</span> Adam Twiss, Zeus Technology Ltd, http:<span
style="color: #000000; font-weight: bold;">//</span>www.zeustech.net<span
style="color: #000000; font-weight: bold;">/</span><br
/> Licensed to The Apache Software Foundation, http:<span
style="color: #000000; font-weight: bold;">//</span>www.apache.org<span
style="color: #000000; font-weight: bold;">/</span><br
/> Benchmarking localhost <span
style="color: #7a0874; font-weight: bold;">&#40;</span>be patient<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> Completed <span
style="color: #000000;">100</span> requests<br
/> Completed <span
style="color: #000000;">200</span> requests<br
/> Completed <span
style="color: #000000;">300</span> requests<br
/> Completed <span
style="color: #000000;">400</span> requests<br
/> Completed <span
style="color: #000000;">500</span> requests<br
/> Finished <span
style="color: #000000;">500</span> requests<br
/> Server Software: Apache<span
style="color: #000000; font-weight: bold;">/</span>2.2.9<br
/> Server Hostname: localhost<br
/> Server Port: <span
style="color: #000000;">80</span><br
/> Document Path: <span
style="color: #000000; font-weight: bold;">/</span>willdurand<span
style="color: #000000; font-weight: bold;">/</span><br
/> Document Length: <span
style="color: #000000;">38360</span> bytes<br
/> Concurrency Level: <span
style="color: #000000;">50</span><br
/> Time taken <span
style="color: #000000; font-weight: bold;">for</span> tests: <span
style="color: #000000;">84.838</span> seconds<br
/> Complete requests: <span
style="color: #000000;">500</span><br
/> Failed requests: <span
style="color: #000000;">28</span><br
/> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>Connect: <span
style="color: #000000;">0</span>, Receive: <span
style="color: #000000;">0</span>, Length: <span
style="color: #000000;">28</span>, Exceptions: <span
style="color: #000000;">0</span><span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> Write errors: <span
style="color: #000000;">0</span><br
/> Non-2xx responses: <span
style="color: #000000;">5</span><br
/> Total transferred: <span
style="color: #000000;">19215376</span> bytes<br
/> HTML transferred: <span
style="color: #000000;">19019345</span> bytes<br
/> Requests per second: <span
style="color: #000000;">5.89</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span><span
style="color: #666666; font-style: italic;">#/sec] (mean)</span><br
/> Time per request: <span
style="color: #000000;">8483.797</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> Time per request: <span
style="color: #000000;">169.676</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#93;</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>mean, across all concurrent requests<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> Transfer rate: <span
style="color: #000000;">221.19</span> <span
style="color: #7a0874; font-weight: bold;">&#91;</span>Kbytes<span
style="color: #000000; font-weight: bold;">/</span>sec<span
style="color: #7a0874; font-weight: bold;">&#93;</span> received<br
/> Connection Times <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> min mean<span
style="color: #7a0874; font-weight: bold;">&#91;</span>+<span
style="color: #000000; font-weight: bold;">/</span>-sd<span
style="color: #7a0874; font-weight: bold;">&#93;</span> median max<br
/> Connect: <span
style="color: #000000;">0</span> <span
style="color: #000000;">9</span> <span
style="color: #000000;">29.4</span> <span
style="color: #000000;">0</span> <span
style="color: #000000;">147</span><br
/> Processing: <span
style="color: #000000;">788</span> <span
style="color: #000000;">8372</span> <span
style="color: #000000;">11975.1</span> <span
style="color: #000000;">3746</span> <span
style="color: #000000;">84661</span><br
/> Waiting: <span
style="color: #000000;">786</span> <span
style="color: #000000;">8295</span> <span
style="color: #000000;">11930.9</span> <span
style="color: #000000;">3696</span> <span
style="color: #000000;">84261</span><br
/> Total: <span
style="color: #000000;">788</span> <span
style="color: #000000;">8382</span> <span
style="color: #000000;">11977.4</span> <span
style="color: #000000;">3753</span> <span
style="color: #000000;">84764</span><br
/> Percentage of the requests served within a certain <span
style="color: #000000; font-weight: bold;">time</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>ms<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> <span
style="color: #000000;">50</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">3753</span><br
/> <span
style="color: #000000;">66</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">6488</span><br
/> <span
style="color: #000000;">75</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">9115</span><br
/> <span
style="color: #000000;">80</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">10478</span><br
/> <span
style="color: #000000;">90</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">15884</span><br
/> <span
style="color: #000000;">95</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">34825</span><br
/> <span
style="color: #000000;">98</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">51623</span><br
/> <span
style="color: #000000;">99</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">75095</span><br
/> <span
style="color: #000000;">100</span><span
style="color: #000000; font-weight: bold;">%</span> <span
style="color: #000000;">84764</span> <span
style="color: #7a0874; font-weight: bold;">&#40;</span>longest request<span
style="color: #7a0874; font-weight: bold;">&#41;</span><br
/> will-serv:~<span
style="color: #666666; font-style: italic;">#</span></div></div><p
style="text-align: justify;">Moins satisfaisant même si le serveur répond bien, il met plus de temps et perds quelques requêtes…</p><p
style="text-align: justify;">Un ab 1000/100 me donne les résultats suivants :</p><p
style="text-align: justify;">- 4,42 requests/second</p><p
style="text-align: justify;">- 14% d’échec</p><p
style="text-align: justify;">- 66% des requêtes en moins de 6s</p><p
style="text-align: justify;"></p><h2>Plus loin dans les optimisations</h2><p
style="text-align: justify;">Dernière option, <strong>mettre le repertoire de cache en Ramdisk</strong>, cette fois-ci c’est très bénéfique et un ab 200/1 passe à 7,21 requêtes par seconde. Et un ab 200/5 passe à 6,97 requêtes par seconde en ayant 98% des requêtes traitées en moins de 3s.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;"><em>Webwait</em> obtenu :  Average load time after  10 runs : 0,41s.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Après cela, j’ai réfléchi à ma <strong>gestion des ressources</strong>. Aidé par <a
href="http://twitter.com/madmatah">@madmatah</a>, je me suis intéressé à la configuration <strong>Apache2</strong> et au <strong>MPM Prefork</strong>. Après une série d’Apache Bench, j’ai configuré ce module comme suit :</p><div
class="codecolorer-container bash vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">StartServers <span
style="color: #000000;">1</span><br
/> MinSpareServers <span
style="color: #000000;">1</span><br
/> MaxSpareServers <span
style="color: #000000;">1</span><br
/> MaxClients <span
style="color: #000000;">3</span><br
/> MaxRequestsPerChild <span
style="color: #000000;">0</span></div></div><p
style="text-align: justify;">J’ai également passé le <strong>timeout</strong> à 2 secondes. Le <strong>load average devient ainsi inférieur</strong><strong> à 1.</strong> Pour surveiller le load average ainsi que les utilisations de la RAM et du SWAP je me suis servi de la commande<div
class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">htop</div></div>mais aussi de<div
class="codecolorer-container text vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div
class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dstat et ses paramètres qui vont bien : -dcgilmsy.</div></div></p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Au final, j’ai modifié mes premiers essais :</p><p
style="text-align: justify;">- Le Ramdisk est passé de <strong>32Mo à 4Mo</strong>. Il stocke désormais le cache HTML de mon site.</p><p
style="text-align: justify;">- Memcached est lancé avec <strong>8Mo</strong> alloués.</p><p
style="text-align: justify;"></p><p
style="text-align: justify;">Par contre le <strong>KeepAlive</strong> est toujours sur <strong>Off</strong>. <span
style="text-decoration: underline;">J’ai de gros soucis dès que je le passe à On&#8230;</span></p><p
style="text-align: justify;">Dernière optimisation faite : l&#8217;ajout des options de montage <strong>noatime</strong> et <strong>nodiratime</strong> sur mes volumes dans <em>/etc/fstab</em>.</p><p
style="text-align: justify;"></p><h2>Conclusion</h2><p
style="text-align: justify;">Le manque de puissance CPU se fait énormément ressentir. Au niveau RAM, on s&#8217;en sort très bien car il est rare qu&#8217;elle soit saturée. Mais le CPU est très vite à 100% d&#8217;utilisation et peine à revenir. Il faudrait voir avec des ressources supplémentaires.</p><p
style="text-align: justify;">Une telle part reste un bon début pour se faire la main sur un serveur dédié, pas cher, souple et scalable il ne démérite pas.</p><p
style="text-align: justify;">Cependant, avec l&#8217;utilisation de Memcached, on limite les accès base de données (et donc disque). Un serveur RPS chez OVH ne fait pas le poids au niveau de la rapidité d&#8217;accès disque face à une part Gandi, il serait intéressant de reprendre ma configuration et de la porter sur un serveur RPS afin d&#8217;établir un comparatif. Je pense faire ça le mois prochain.</p><p
style="text-align: justify;">Pour terminer, j&#8217;ai toujours des soucis avec le <strong>KeepAlive</strong> à <strong>On</strong>, les temps minimums de traitement d&#8217;une requête sont de l&#8217;ordre du <strong>KeepAliveTimeout</strong>&#8230;</p><p
style="text-align: justify;">Voici également deux screens des interfaces de gestion <strong>Memcached</strong> et <strong>APC</strong> que j&#8217;utilise :</p><p
style="text-align: center;"><a
href="http://www.willdurand.fr/uploads/willserv/apc.png"></a><a
href="http://www.willdurand.fr/wp-content/uploads/2010/07/apc.png" rel="lightbox[52]" title="apc"><img
class="aligncenter size-medium wp-image-350" title="apc" src="http://www.willdurand.fr/wp-content/uploads/2010/07/apc-300x156.png" alt="" width="300" height="156" /></a></p><p
style="text-align: center;"><a
href="http://www.willdurand.fr/uploads/willserv/memcache.png"></a><a
href="http://www.willdurand.fr/wp-content/uploads/2010/07/memcache.png" rel="lightbox[52]" title="memcache"><img
class="aligncenter size-medium wp-image-351" title="memcache" src="http://www.willdurand.fr/wp-content/uploads/2010/07/memcache-300x156.png" alt="" width="300" height="156" /></a></p><p
style="text-align: justify;">Merci à <a
href="http://www.mrboo.fr">www.mrboo.fr</a> pour ses tests et retours d&#8217;expérience.</p><p
style="text-align: justify;">Merci à <a
href="http://twitter.com/madmatah">@madmatah</a> pour ses nombreux conseils et son temps.</p><p
style="text-align: justify;">Le mot de la fin : le site sur lequel vous vous trouvez n&#8217;a pas subi les modifications précédentes&#8230;</p><h3 class='related_post_title'>Related Posts</h3><ul
class='related_post'><li><a
href='http://www.willdurand.fr/dedibox-v3-nginx-php-fpm-apache2-apc-memcached-mysql/' title='Dédibox v3 : Nginx + PHP-FPM + Apache2 + APC + Memcached + MySQL'>Dédibox v3 : Nginx + PHP-FPM + Apache2 + APC + Memcached + MySQL</a></li><li><a
href='http://www.willdurand.fr/forumphp-resume-de-la-seconde-journee/' title='#forumPHP : résumé de ma seconde journée'>#forumPHP : résumé de ma seconde journée</a></li><li><a
href='http://www.willdurand.fr/forumphp-resume-de-ma-premiere-journee/' title='#forumPHP : résumé de ma première journée'>#forumPHP : résumé de ma première journée</a></li><li><a
href='http://www.willdurand.fr/replication-mysql-maitre-esclave/' title='Réplication MySQL maître-esclave'>Réplication MySQL maître-esclave</a></li><li><a
href='http://www.willdurand.fr/creation-automatique-dun-projet-symfony-mysql-git-et-apache2/' title='Création automatique d&#8217;un projet symfony + MySQL + Git et Apache2'>Création automatique d&#8217;un projet symfony + MySQL + Git et Apache2</a></li></ul> <a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/printfriendly.png" class="sociable-img sociable-hovers" title="Print" alt="Print" /></a><a
rel="nofollow" target="_blank"  href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F&amp;title=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2&amp;bodytext=%0D%0AApr%C3%A8s%20avoir%20bien%20optimis%C3%A9%20toute%20la%20partie%20frontend%20de%20mon%20site%20au%20sens%20HTML%2C%20CSS%2C%20JavaScript%2C%20etc%2C%20je%20me%20suis%20pench%C3%A9%20sur%20les%20aspects%20plus%20techniques%20et%20technologiques.%20Je%20parlerai%20donc%20de%20PHP%2C%20de%20MySQL%2C%20de%20serveur%20Apache2%2C%20de%20Memcached%2C%20d%E2%80%99Opco" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/digg.png" class="sociable-img sociable-hovers" title="Digg" alt="Digg" /></a><a
rel="nofollow" target="_blank"  href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F&amp;title=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/stumbleupon.png" class="sociable-img sociable-hovers" title="StumbleUpon" alt="StumbleUpon" /></a><a
rel="nofollow" target="_blank"  href="http://delicious.com/post?url=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F&amp;title=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2&amp;notes=%0D%0AApr%C3%A8s%20avoir%20bien%20optimis%C3%A9%20toute%20la%20partie%20frontend%20de%20mon%20site%20au%20sens%20HTML%2C%20CSS%2C%20JavaScript%2C%20etc%2C%20je%20me%20suis%20pench%C3%A9%20sur%20les%20aspects%20plus%20techniques%20et%20technologiques.%20Je%20parlerai%20donc%20de%20PHP%2C%20de%20MySQL%2C%20de%20serveur%20Apache2%2C%20de%20Memcached%2C%20d%E2%80%99Opco" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/delicious.png" class="sociable-img sociable-hovers" title="del.icio.us" alt="del.icio.us" /></a><a
rel="nofollow" target="_blank"  href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F&amp;t=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/facebook.png" class="sociable-img sociable-hovers" title="Facebook" alt="Facebook" /></a><a
rel="nofollow" target="_blank"  href="http://twitter.com/home?status=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2%20-%20http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/twitter.png" class="sociable-img sociable-hovers" title="Twitter" alt="Twitter" /></a><a
rel="nofollow" target="_blank"  href="http://www.google.com/bookmarks/mark?op=edit&amp;bkmk=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F&amp;title=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2&amp;annotation=%0D%0AApr%C3%A8s%20avoir%20bien%20optimis%C3%A9%20toute%20la%20partie%20frontend%20de%20mon%20site%20au%20sens%20HTML%2C%20CSS%2C%20JavaScript%2C%20etc%2C%20je%20me%20suis%20pench%C3%A9%20sur%20les%20aspects%20plus%20techniques%20et%20technologiques.%20Je%20parlerai%20donc%20de%20PHP%2C%20de%20MySQL%2C%20de%20serveur%20Apache2%2C%20de%20Memcached%2C%20d%E2%80%99Opco" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/googlebookmark.png" class="sociable-img sociable-hovers" title="Google Bookmarks" alt="Google Bookmarks" /></a><a
rel="nofollow" target="_blank"  href="http://www.friendfeed.com/share?title=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2&amp;link=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/friendfeed.png" class="sociable-img sociable-hovers" title="FriendFeed" alt="FriendFeed" /></a><a
rel="nofollow" target="_blank"  href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F&amp;title=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2&amp;source=William%26%23039%3Bs+Blog+D%C3%A9veloppeur+web+ind%C3%A9pendant%2C+%C3%A9tudiant+et+passionn%C3%A9+%21+%23Symfony2+%23Rails+%23Diem+%23Git+%23Nginx+%23WebPerfs+%23SoftwareQuality&amp;summary=%0D%0AApr%C3%A8s%20avoir%20bien%20optimis%C3%A9%20toute%20la%20partie%20frontend%20de%20mon%20site%20au%20sens%20HTML%2C%20CSS%2C%20JavaScript%2C%20etc%2C%20je%20me%20suis%20pench%C3%A9%20sur%20les%20aspects%20plus%20techniques%20et%20technologiques.%20Je%20parlerai%20donc%20de%20PHP%2C%20de%20MySQL%2C%20de%20serveur%20Apache2%2C%20de%20Memcached%2C%20d%E2%80%99Opco" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/linkedin.png" class="sociable-img sociable-hovers" title="LinkedIn" alt="LinkedIn" /></a><a
rel="nofollow" target="_blank"  href="http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F&amp;t=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/myspace.png" class="sociable-img sociable-hovers" title="MySpace" alt="MySpace" /></a><a
rel="nofollow" target="_blank"  href="http://www.netvibes.com/share?title=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2&amp;url=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/netvibes.png" class="sociable-img sociable-hovers" title="Netvibes" alt="Netvibes" /></a><a
rel="nofollow" target="_blank"  href="http://www.printfriendly.com/print/new?url=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/pdf.png" class="sociable-img sociable-hovers" title="PDF" alt="PDF" /></a><a
rel="nofollow" target="_blank"  href="http://ping.fm/ref/?link=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F&amp;title=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2&amp;body=%0D%0AApr%C3%A8s%20avoir%20bien%20optimis%C3%A9%20toute%20la%20partie%20frontend%20de%20mon%20site%20au%20sens%20HTML%2C%20CSS%2C%20JavaScript%2C%20etc%2C%20je%20me%20suis%20pench%C3%A9%20sur%20les%20aspects%20plus%20techniques%20et%20technologiques.%20Je%20parlerai%20donc%20de%20PHP%2C%20de%20MySQL%2C%20de%20serveur%20Apache2%2C%20de%20Memcached%2C%20d%E2%80%99Opco" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/ping.png" class="sociable-img sociable-hovers" title="Ping.fm" alt="Ping.fm" /></a><a
rel="nofollow" target="_blank"  href="http://www.willdurand.fr/feed/" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/rss.png" class="sociable-img sociable-hovers" title="RSS" alt="RSS" /></a><a
rel="nofollow" target="_blank"  href="http://technorati.com/faves?add=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/technorati.png" class="sociable-img sociable-hovers" title="Technorati" alt="Technorati" /></a><a
rel="nofollow" target="_blank"  href="http://www.viadeo.com/shareit/share/?url=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F&title=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2&urllanguage=fr" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/viadeo.png" class="sociable-img sociable-hovers" title="viadeo FR" alt="viadeo FR" /></a><a
rel="nofollow" target="_blank"  href="http://www.wikio.com/vote?url=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/wikio.png" class="sociable-img sociable-hovers" title="Wikio" alt="Wikio" /></a><a
rel="nofollow" target="_blank"  href="http://buzz.yahoo.com/submit/?submitUrl=http%3A%2F%2Fwww.willdurand.fr%2Foptimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2%2F&amp;submitHeadline=Optimiser%20son%20application%20web%20en%20jouant%20sur%20PHP%2C%20MySQL%20et%20Apache2&amp;submitSummary=%0D%0AApr%C3%A8s%20avoir%20bien%20optimis%C3%A9%20toute%20la%20partie%20frontend%20de%20mon%20site%20au%20sens%20HTML%2C%20CSS%2C%20JavaScript%2C%20etc%2C%20je%20me%20suis%20pench%C3%A9%20sur%20les%20aspects%20plus%20techniques%20et%20technologiques.%20Je%20parlerai%20donc%20de%20PHP%2C%20de%20MySQL%2C%20de%20serveur%20Apache2%2C%20de%20Memcached%2C%20d%E2%80%99Opco&amp;submitCategory=science&amp;submitAssetType=text" ><img
src="http://www.willdurand.fr/wp-content/plugins/sociable-30/images/default/16/yahoobuzz.png" class="sociable-img sociable-hovers" title="Yahoo! Buzz" alt="Yahoo! Buzz" /></a><br
/><br
/>]]></content:encoded> <wfw:commentRss>http://www.willdurand.fr/optimiser-son-application-web-en-jouant-sur-php-mysql-et-apache2/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced)
Database Caching 2/21 queries in 0.014 seconds using memcached
Object Caching 1457/1502 objects using memcached

Served from: www.willdurand.fr @ 2012-02-06 08:21:07 -->
