memcache https://keopx.net/ es Instalar APC y Memcache para Drupal https://keopx.net/blog/instalar-apc-y-memcache-para-drupal <span>Instalar APC y Memcache para Drupal</span> <div class="text-content clearfix field field--name-body field--type-text-with-summary field--label-hidden field__item"><h1 id="APC">APC</h1> <p>Instalamos el paquete de apc para php5</p> <pre lang="bash" line="1" xml:lang="bash"> $ sudo aptitude install php-apc</pre><h1 id="Memcache">Memcache</h1> <h2 id="Servidor-de-memcache">Servidor de memcache</h2> <pre lang="bash" xml:lang="bash"> $ sudo aptitude install memcached</pre><h2 id="Memcache-para-php5">Memcache para php5</h2> <p>El modulo por defecto del php5-memcache de fallos y parece que según el CVS para la siguiente versión va estar corregido. </p> <!--break--><p> Es necesario el compilarlo a pelo:</p> <pre lang="bash" line="1" xml:lang="bash"> $ wget http://pecl.php.net/get/memcache-2.2.5.tgz $ tar -zxvf memcached-2.2.5.tgz $ cd memcached-2.2.5 $ phpize &amp;&amp; ./configure --enable-memcache &amp;&amp; make $ sudo cp memcache.so /usr/lib/php5/20060613+lfs/ $ cd /etc/php5/apache2/conf.d/ $ sudo su $ echo 'extension=memcache.so' &gt; /etc/php.d/memcached.ini $ /etc/init.d/apache2 restart</pre><p>Ahora ya configuramos los parámetros.</p> <div id="change-2311"> <div id="journal-2311-notes"> <h1 id="phpini">php.ini</h1> <pre lang="bash" line="1" xml:lang="bash"> $ sudo nano /etc/php5/apache2/php.ini</pre><p>Y añadimos:</p> <pre lang="bash" line="1" xml:lang="bash"> ; Memcache memcache.hash_strategy="consistent"</pre><h1 id="settingsphp">settings.php</h1> <p>Configuración del cache para nuestro sitio. Esta sacado de <a href="http://www.lullabot.com/">lullabot</a>.</p> <pre lang="php" line="1" xml:lang="php"> <!--?php $conf = array( // The path to wherever memcache.inc is. The easiest is to simply point it // to the copy in your module's directory. //'cache_inc' =--> './sites/all/modules/memcache/memcache.inc', // or 'cache_inc' =&gt; './sites/all/modules/memcache/memcache.db.inc', 'memcache_servers' =&gt; array( 'localhost:11211' =&gt; 'default', 'localhost:11212' =&gt; 'content', 'localhost:11213' =&gt; 'filter', 'localhost:11214' =&gt; 'menu', 'localhost:11215' =&gt; 'page', 'localhost:11216' =&gt; 'views', ), 'memcache_bins' =&gt; array( 'cache' =&gt; 'default', 'cache_content' =&gt; 'content', 'cache_filter' =&gt; 'filter', 'cache_menu' =&gt; 'menu', 'cache_page' =&gt; 'page', 'cache_views' =&gt; 'views', ), ); ?&gt;</pre><h1 id="Servidor-de-memcache">Servidor de memcache</h1> <p>Editamos el fichero de memcache y lo configuramos con los siguientes parámetros personalizados.</p> <pre lang="bash" line="1" xml:lang="bash"> $ sudo nano /etc/init.d/memcache</pre><p>Estos parámetros variaran según el hardware y aplicación.</p> <pre lang="bash" line="1" xml:lang="bash"> #!/bin/bash prog="memcached" start() { echo -n $"Starting $prog " # Sessions cache. memcached -m 16 -l 0.0.0.0 -p 11211 -d -u nobody # Default cache. memcached -m 32 -l 0.0.0.0 -p 11212 -d -u nobody # Block cache. memcached -m 32 -l 0.0.0.0 -p 11213 -d -u nobody # Content cache. Holds fully loaded content type structures. memcached -m 16 -l 0.0.0.0 -p 11214 -d -u nobody # Filter cache. Usually the busiest cache after the default. memcached -m 32 -l 0.0.0.0 -p 11215 -d -u nobody # Form cache. memcached -m 32 -l 0.0.0.0 -p 11216 -d -u nobody # Menu cache. memcached -m 32 -l 0.0.0.0 -p 11217 -d -u nobody # Page cache. Bigger than most other caches. memcached -m 128 -l 0.0.0.0 -p 11218 -d -u nobody # Views definition cache. memcached -m 1 -l 0.0.0.0 -p 11219 -d -u nobody # Views data cache (may need to be increased if heavily used). memcached -m 32 -l 0.0.0.0 -p 11220 -d -u nobody # More caches that might be added later: # Users table. #/usr/bin/memcached -m 24 -l 0.0.0.0 -p 11219 -d -u nobody # Path source cache. #/usr/bin/memcached -m 4 -l 0.0.0.0 -p 11220 -d -u nobody # Path destination cache. #/usr/bin/memcached -m 6 -l 0.0.0.0 -p 11221 -d -u nobody RETVAL=$? echo return $RETVAL } stop() { if test "x`pidof memcached`" != x; then echo -n $"Stopping $prog " killall memcached echo fi RETVAL=$? return $RETVAL } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; condrestart) if test "x`pidof memcached`" != x; then stop start fi ;; *) echo $"Usage: $0 {start|stop|restart|condrestart}" exit 1 esac exit $RETVAL</pre><h1 id="Referencias">Referencias</h1> <ul><li><a href="http://www.lullabot.com/articles/setup-memcached-mamp-sandbox-environment">http://www.lullabot.com/articles/setup-memcached-mamp-sandbox-environment</a></li> <li><a href="http://www.lullabot.com/articles/how_install_memcache_debian_etch">http://www.lullabot.com/articles/how_install_memcache_debian_etch</a></li> <li><a href="http://drupal.org/project/memcache">http://drupal.org/project/memcache</a></li> <li><a href="http://www.lullabot.com/articles/a_beginners_guide_to_caching_data">http://www.lullabot.com/articles/a_beginners_guide_to_caching_data</a></li> <li><a href="http://www.howtoforge.com/installing-memcached-and-the-php5-memcache-module-on-debian-etch-apache2">http://www.howtoforge.com/installing-memcached-and-the-php5-memcache-module-on-debian-etch-apache2</a></li> <li><a href="http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/">http://livebookmark.net/journal/2008/05/21/memcachephp-stats-like-apcphp/</a></li> <li><a href="http://de.php.net/manual/en/memcache.installation.php#95063">http://de.php.net/manual/en/memcache.installation.php#95063</a></li> <li><a href="http://blogofsysadmins.com/instalar-memcached-en-centos-5-3">http://blogofsysadmins.com/instalar-memcached-en-centos-5-3</a></li> </ul></div> </div> </div> <span><span>keopx</span></span> <span><time datetime="2010-04-29T12:23:50+02:00" title="Jueves, Abril 29, 2010 - 12:23">Jue, 29/04/2010 - 12:23</time> </span> <div class="field field--name-field-tax-cat field--type-entity-reference field--label-above"> <div class="field__label">Categoria</div> <div class="field__items"> <div class="field__item"><a href="/categoria/php" hreflang="es">PHP</a></div> <div class="field__item"><a href="/categoria/gnu-linux" hreflang="es">GNU Linux</a></div> <div class="field__item"><a href="/categoria/drupal" hreflang="es">Drupal</a></div> <div class="field__item"><a href="/categoria/drupal-planeta" hreflang="es">Drupal Planeta</a></div> </div> </div> <div class="field field--name-field-tax-tag field--type-entity-reference field--label-above"> <div class="field__label">Tag</div> <div class="field__items"> <div class="field__item"><a href="/tag/rendimiento" hreflang="es">Rendimiento</a></div> <div class="field__item"><a href="/tag/php" hreflang="es">php</a></div> <div class="field__item"><a href="/tag/memcache" hreflang="es">memcache</a></div> <div class="field__item"><a href="/tag/cache" hreflang="es">cache</a></div> </div> </div> <section data-drupal-selector="comments" class="comments"> <h2 class="comments__title">Comentarios</h2> <div class="add-comment"> <div class="add-comment__form"> <drupal-render-placeholder callback="comment.lazy_builders:renderForm" arguments="0=node&amp;1=181&amp;2=field_comments&amp;3=comment" token="mjBtBpEleUb_ZMgTFheheRElvUgBOSg-e1vlPY3ZG74"></drupal-render-placeholder> </div> </div> </section> Thu, 29 Apr 2010 10:23:50 +0000 keopx 181 at https://keopx.net