Advertisement:
NameCheap

Author Topic: Memcache and APC together  (Read 10696 times)

Offline sevamaster

  • Semi-Newbie
  • *
  • Posts: 48
  • Gender: Male
    • Free Seo Tools
Memcache and APC together
« on: February 02, 2012, 11:33:04 AM »
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

Offline Oldiesmann

  • Lead Developer
  • SMF Super Hero
  • *
  • Posts: 24,117
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Memcache and APC together
« Reply #1 on: February 02, 2012, 11:58:40 AM »
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 :)

Offline sevamaster

  • Semi-Newbie
  • *
  • Posts: 48
  • Gender: Male
    • Free Seo Tools
Re: Memcache and APC together
« Reply #2 on: February 02, 2012, 02:10:25 PM »
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])?

Offline Oldiesmann

  • Lead Developer
  • SMF Super Hero
  • *
  • Posts: 24,117
  • Gender: Male
  • Ask me about the function DB :)
    • oldiesmann on Facebook
    • Oldiesmann on GitHub
    • http://www.linkedin.com/in/michaeleshom on LinkedIn
    • @oldiesmann on Twitter
    • Archie Comics Fan Forum
Re: Memcache and APC together
« Reply #3 on: February 02, 2012, 04:17:34 PM »
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.

Offline Vekseid

  • Full Member
  • ***
  • Posts: 549
  • Gender: Male
    • Elliquiy Adult Role Playing Forums
Re: Memcache and APC together
« Reply #4 on: February 20, 2012, 01:33:48 AM »
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.

Offline Mark Rose

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 2,498
  • Gender: Male
  • Performance Freak
Re: Memcache and APC together
« Reply #5 on: February 20, 2012, 01:56:23 PM »
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.
Hello, IT. Have you tried turning it off and on again?

Offline CoreISP

  • Server Admin
  • Server Team
  • SMF Super Hero
  • *
  • Posts: 13,359
  • Gender: Male
  • CoreISP.net
    • coreisp on Facebook
    • liroyvh on LinkedIn
    • @liroyvh on Twitter
    • CoreISP Corporation :: WebHosting, Dedicated Servers, and more!
Re: Memcache and APC together
« Reply #6 on: February 24, 2012, 02:19:10 PM »
Wouldnt it work to make memcached handle the sessions and use APC as the caching?
Personally never tried it though.
- CoreISP.net Corporation -
  WebHosting, Colocation, Domain Registration & Network Services
- DedicatedBox.us Servers -
  Low priced Servers in a high-quality Network, the place for all your (advanced) server needs.
  We specialize in hosting big boards. Contact us!

((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.

Offline Gandon Suka

  • Newbie
  • *
  • Posts: 1
Re: Memcache and APC together
« Reply #7 on: March 25, 2012, 01:12:22 AM »
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. 

Offline Pernat1y

  • Newbie
  • *
  • Posts: 1
Re: Memcache and APC together
« Reply #8 on: March 01, 2013, 03:47:35 AM »
Sorry for bumping old topic, but...
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

Offline CoreISP

  • Server Admin
  • Server Team
  • SMF Super Hero
  • *
  • Posts: 13,359
  • Gender: Male
  • CoreISP.net
    • coreisp on Facebook
    • liroyvh on LinkedIn
    • @liroyvh on Twitter
    • CoreISP Corporation :: WebHosting, Dedicated Servers, and more!
Re: Memcache and APC together
« Reply #9 on: March 01, 2013, 06:53:53 AM »
That has already been pointed out, twice. ;)
- CoreISP.net Corporation -
  WebHosting, Colocation, Domain Registration & Network Services
- DedicatedBox.us Servers -
  Low priced Servers in a high-quality Network, the place for all your (advanced) server needs.
  We specialize in hosting big boards. Contact us!

((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.

Offline Ricky.

  • Customizer
  • SMF Hero
  • *
  • Posts: 4,026
    • Indian Linux Forums
Re: Memcache and APC together
« Reply #10 on: March 01, 2013, 07:56:26 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.

Offline CoreISP

  • Server Admin
  • Server Team
  • SMF Super Hero
  • *
  • Posts: 13,359
  • Gender: Male
  • CoreISP.net
    • coreisp on Facebook
    • liroyvh on LinkedIn
    • @liroyvh on Twitter
    • CoreISP Corporation :: WebHosting, Dedicated Servers, and more!
Re: Memcache and APC together
« Reply #11 on: March 01, 2013, 08:33:13 AM »
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.
- CoreISP.net Corporation -
  WebHosting, Colocation, Domain Registration & Network Services
- DedicatedBox.us Servers -
  Low priced Servers in a high-quality Network, the place for all your (advanced) server needs.
  We specialize in hosting big boards. Contact us!

((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.

Offline Arantor

  • SMF Friend
  • SMF Legend
  • *
  • Posts: 62,233
Re: Memcache and APC together
« Reply #12 on: March 01, 2013, 08:36:42 AM »
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)
And his eyes have all the seeming of a demon's that is dreaming,
And the lamp-light o'er him streaming throws his shadow on the floor