News:

Wondering if this will always be free?  See why free is better.

Main Menu

Memcache and APC together

Started by sevamaster, February 02, 2012, 11:33:04 AM

Previous topic - Next topic

sevamaster

To SMF experts.

My server has APC installed and  smf detects and uses it (level 3 caching).
Yesterday, I installed memcache and  filled in the Memcache settings: IP address (using a single server).
Visually, no changes in speed are noticed.

Tell me please, could  the sms use two caching instruments (because they are using two different caching)?
And if not, what should I use?

Note, that if  Memcache is preferable, then in any case the smf says that APC is detected.
That is, if the APC and Memcache installed and there is  IP prescribed  for Memcache, which one (or both) will be used?

Thank you.


PS. SMF 2.0.2

Oldiesmann

If you have memcache set up, SMF will use it instead of APC or any other cache thing on your server.

SMF checks for things in the following order when trying to cache things:
memcache
eAccelerator
MMCache
APC
Zend Platform
xCache

I'm not sure why, or why it's detecting APC before memcache, but that's the way things work :)
Michael Eshom
Christian Metal Fans

sevamaster

Thank you Oldiesmann.
So, it's not possible to use both  (apc and memcache) at the same time?
If so, which one is better for smf (which to use[ or disable])?

Oldiesmann

No, it's not possible to use both at the same time, and it wouldn't work too well if you did - why would you cache something multiple times with two different services, and how would SMF know which one was the most up to date?

I don't know which is better as I have no experience with memcached. I'm sure someone else here can answer that though.
Michael Eshom
Christian Metal Fans

Vekseid

APC is somewhat faster than Memcached, since it makes an internal call rather than going over a socket - a network socket at that.

However, memcached, being a distributed cache, is useful if you want to cache a ridiculous amount of data. However, I've never found that SMF takes much advantage of this possibility, or well (in fact caching at level 3 gives serious issues).

Using both is useful in a small set of limited circumstances. For example, in the new CMS code I've written, multiple machines may have unique configurations associated with them. Thus, the config data gets loaded by APC (apc_load_constants), while memcached caches everything else in one or more pools.
Adult Role Playing Forums - - Over five million posts - - Elliquiy's LAMP configuration (maybe NSFW)

Blog about Forums and Servers - - Twenty things to make Simple Machines Forum go faster

Private/Instant Message requests for free support will be ignored.

Something like that

You certainly do want to have APC running through, to cache the compiled PHP files. APC is more than adequate for SMF. I'd configure it with 64MB of cache, or more if you're running other PHP scripts.

Also make sure that memcached is only listening on an internal IP unless your firewall it from outside access, if you decide to continue using it.

LiroyvH

Wouldnt it work to make memcached handle the sessions and use APC as the caching?
Personally never tried it though.
((U + C + I)x(10 − S)) / 20xAx1 / (1 − sin(F / 10))
President/CEO of Simple Machines - Server Manager
Please do not PM for support - anything else is usually OK.

Gandon Suka

Since you run VPS there are much more option to speed up SMF serving as a solo website or as a part of a large project as well.

As per your  question that concers only two boosters: try APC to feel diference otherwise there would be no effect with memcache or memcached in. 

Pernat1y

Sorry for bumping old topic, but...
Quote from: Oldiesmann on February 02, 2012, 04:17:34 PM
it wouldn't work too well if you did - why would you cache something multiple times with two different services
You are wrong. They will work well together (and it's prefered to use both of them) because they caching different things.
Memcached caches data and objects
APC caches bytecode to speedup execution of PHP scripts itself

LiroyvH

That has already been pointed out, twice. ;)
((U + C + I)x(10 − S)) / 20xAx1 / (1 − sin(F / 10))
President/CEO of Simple Machines - Server Manager
Please do not PM for support - anything else is usually OK.

Ricky.

Quote from: CoreISP on March 01, 2013, 06:53:53 AM
That has already been pointed out, twice. ;)
Still wondering why SMF uses single if all is available, I had similar situation and had hacked bit to use both.

I think there should be option to Select either of Disk cache and Memcache
And one among rest.. because others ie. Xcache, APC, eaccelerator are essentially doing same kind of thing.

LiroyvH

Well, you can compile and configure PHP in such a way that it always uses memcache, then set SMF to use APC.
Should, in theory, work.

On another note, either should always work. For example, if you have XCache, you don't have to enable caching through XCache in SMF in order to make it cache some material plus write stuff to memcached.
I haven't debugged it though so i'm not entirely sure WHAT it stores where when both memcached + xcache are enabled, but I must say that memcached + xcache + nginx are giving me _outstanding_ results on a huge forum around here.
((U + C + I)x(10 − S)) / 20xAx1 / (1 − sin(F / 10))
President/CEO of Simple Machines - Server Manager
Please do not PM for support - anything else is usually OK.

Arantor

If only that were what the caching system actually did... which it isn't.

The caching system only supports one target at a time because that's the target it's using to store data. It's why eAccelerator should be removed if it hasn't been already because current versions don't support storing data (it's now just a bytecode cache)

Consider for a moment the logic of what you are saying. Bytecode caches store the parsing - how would you tell the cache not to cache from inside what you are caching? Doesn't really make a lot of sense.

How can you possibly use two caches when you only want to save and retrieve data? The bytecode caching would still be done anyway, right?


EDIT: Core, I'm presuming you're using memcache to handle sessions through memcache's own session handler and all other data through xcache? (In other words, SMF is configured to use xcache and is not fundamentally aware of memcache)

Advertisement: