APC installing

Events happening in the community are now at Drupal community events on www.drupal.org.
hypertext200's picture

Do we need to use cache_router to install APC cache?. If not how can we install and tweak performance on Drupal.

Comments

Two different things

fgm@drupal.org's picture

Using APC on its own doesn't require cacherouter or APC module in any way. It already brings opcode caching to your configuration, which is likely something you want anyway, as it means less CPU spent tokenizing PHP. Alternatives are zend server, eaccelerator, xcache, all of them focusing on opcode caching.

Installing cacherouter brings different benefits: it allows you to replace all or part of your cache tables (and possibly sessions as well) in the memory reserved by APC for caching, meaning less DB hits. Note that in a really high performance settings, with multiple servers, the benefits of using APC as the replacement caching system are limited by the fact that cache is still per-server instance; using memcached instead allows central caching for all servers heads, usually resulting in a higher hit rate to the cache, hence better performance.

Sessions

designar's picture

Right now sessions aren't stored in an apc cache, it's planned for the next release.
That's another minus in comparison with memcache. But sometimes you don't need the memcached power and benefits, so an apc solution is a good way to go.

I installed memcached and

hypertext200's picture

I installed memcached and still my server load is very high, i'm running one demon on the same server. My SQL also at the same server.
Server configurations are Apache 1.2
PHP, 5.2.10
MySql 5.2
OS: FreeBSD
RAM : 4GB

memcached is running well, but server load increasing upto 80, it will crash the server. What is the best thing that I can do, installing APC break my site, only white pages. I think APC not compatible with the FreeBSD.

Overhead is cause of mysql server, I'm using views module to display 50 images per page with several sorts(about 10).

Senior Drupal Developer at DrupalConnect

Memcached setup

fgm@drupal.org's picture

Have you actually configured memcached ? You have to remember that, out of the box, memcached won't usually help at all : you need to create separate bins for each cache table in your config, enable cacherouter, and declare the bins in the cacherouter variable in settings.php

Also, if you have a MySQL config issue, you should probably configure it first thing, before considering caches.

APC works fine with FreeBSD.

Jamie Holly's picture

APC works fine with FreeBSD. If you're running only a single webserver then APC is the way to go with Cacherouter, considering its faster than Memcached. Memcached is better if you have multiple web servers as you can share the memcached buckets amongst those servers (APC's object cache is available only to the server it is running on).

Did you check your PHP error logs to see if any errors were in there? Also what APC settings did you use? For example, Drupal (and a lot of systems) won't work with apc.stat = 0.

Before that I would go with what FGM is suggesting - tuning MySQL. Instlall the Devel module and enable the query log so you can see which queries are taking the most time. Do a explain on those queries either in the MySQL command line or PhpMyAdmin. If they are doing things like filesorts or temporary tables then spend some time trying to tune them better - usually through creating better indexes. You can also run scripts like MySQL Tuning Primer that gives suggestions on better settings for your database based upon runtime information.

http://forge.mysql.com/projects/project.php?id=44


HollyIT - Grab the Netbeans Drupal Development Tool at GitHub.

;[APC] ;extension=apc.so ;apc

hypertext200's picture

;[APC]
;extension=apc.so
;apc.enabled = 1
;apc.apc.stat = 0
;apc.include_once_override = 1
;apc.shm_size = 64

Hers are the settings may be I used ;apc.apc.stat = 0 which is broke all my sites, Thanks a lot for the help.

Yeah there are many sql queries which are taken about 20-30 seconds to execute, I think explain will address that issue, mainly Drupal using LEFT JOIN is it effective to use JOIN?.

Senior Drupal Developer at DrupalConnect

Views cache ...

kbahey's picture

Use Views 2.6, it has #468824 implemented which enables caching of views. That should reduce the load of your site because of the heavy queries.

Another approach is to move the query from views to a module and use cache_set/get, perhaps with fine tuning the queries to eliminate extra joins in favor of lookups.

As for APC, it is enough to have:

extension=apc.so
apc.enabled = 1
apc.shm_size = 48

The rest is not very important.

And yes, APC runs on *BSD. You may have a version compatibility or did not build properly.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

Drupal performance tuning, development, customization and consulting: 2bits.com, Inc..
Personal blog: Baheyeldin.com.

Changing the join type isn't

kwinters's picture

Changing the join type isn't going to make that much of a difference. Add keys (indexes) to any field you are joining or doing a where on, and tweak your mysql config (there are tons of tutorials on the net). If that doesn't help, the next step is to remove the join entirely and pull in the extra data with a separate query.

Ken Winters

www.coalmarch.com

Ken Winters

I got the APC not active

hypertext200's picture

I got the APC not active cause of the Zend optimizer and when its disable I could run the APC.

Senior Drupal Developer at DrupalConnect

apc vs Zend

g76's picture

which is the best option for Drupal, I am having trouble finding a direct answer. Zend or APC?

APC and FreeBSD 6.3 and Zend Optimizer

gregarios's picture

I'm using APC 3.0.19, FreeBSD 6.3, with Zend Engine v2.2.0 on a Verio VPS. I installed APC in about 3 easy steps found on this page:

http://www.agnivo.com/tech/cache-php-scripts-with-apc-pecl-module-100.html

It works perfectly and lowered my page load times about 80%. The apc.php reporting script it comes with shows all the files in cache, which is essentially a list of all my modules' '.php' and '.inc' files.
Zend Optimizer runs fine along side APC, but you'll not be able to tell until you look in your Drupal Status page. If you run "php -i" to see the APC settings, everything will look good except it will report "APC Support => disabled" if looking from the command line. It won't be disabled really, and you'll see a HUGE difference in performance to prove it.

Use the simple settings kbahey reported a few posts back and you'll be good.

Update: By the way, "views-view-fields.tpl.php" is the most hit cached file in the APC list.

High performance

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: