HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS. ocPortal 9 is superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Need help with php memcache.dll issues

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#111873 (In Topic #22489)
TQ
Avatar

Honoured member

Hi Folks,

In a bid to improve my site performance I have tried to enable use_mem_cache=1 in the Options Editor but receive the following error as a result:

Code

A source-code (caches_memcache...
"Declaration of memcachecache::get
($_key, $min_cache_date = NULL)
should be compatible with MemcachePool::get
($param0, &$param1, &$param2)")
file is missing/corrupt/incompatible.
There are no errors in the php log and phpinfo shows php_memcache.dll as functional:

Code

memcache support enabled
Version 3.0.9-dev
Revision $Revision$
Directive Local Value Master Value
memcache.allow_failover 0 0
memcache.chunk_size 32768 32768
memcache.compress_threshold 20000 20000
memcache.default_port 11211 11211
memcache.hash_function crc32 crc32
memcache.hash_strategy standard standard
memcache.lock_timeout 1 1
memcache.max_failover_attempts 20 20
memcache.protocol ascii ascii
memcache.redundancy 1 1
memcache.session_redundancy 2 2
using these settings in my php.ini

Code

[memcache]
extension=php_memcache.dll
memcache.allow_failover = 0
memcache.chunk_size = 32768
memcache.default_port = 11211
memcache.hash_strategy = standard
memcache.hash_function = crc32
memcache.protocol = ascii
memcache.compress_threshold = 20000
memcache.lock_timeout = 1
Enviroment:

Code

O/S = 64 bit Win Server 2012 R2
Web server = IIS 8.5 using fast-cgi.
PHP = v7.0.7. 32bit
Could anyone suggest what I'm doing wrong?

TQ
Back to the top
 
Posted
Rating:
#111874
Avatar

Hi,

At some point PHP has become incompatible with our code, probably with PHP7.

I've attached a fix.

Attachment
sources/caches_memcache.php
» Download: caches_memcache.php (2 Kb, 36 downloads so far)


That said, I suggest you try wincache:
https://sourceforge.net/projects/wincache/


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111875
TQ
Avatar

Honoured member

Thanks Chris,

I already had wincache installed but the last time I tried it, I got an error. This time I haven't. How strange is that!

Early testing with wincache yields no apparent (page load) improvements in performance. I will try memcache next.

If I don't see any tangible improvement, would you advise to disable memory caching again?

My goal is to get my server response time below 200ms as per Google's PageSpeed Tools Insights> recommendation.

I am aware that I have work to do on one of my miniblocks (thumbnail sizes) to improve the page-load time ie. below it's current 4 seconds (first time load is about 10 sec).

I can live with it as it is, but I enjoy the learning curve. Any pointers would be gratefully received.

Thanks as always for your help & assistance.

TQ
Back to the top
 
Posted
Rating:
#111876
TQ
Avatar

Honoured member

I have decided to disable mem cache as I keep getting the Server error 500 randomly with wincache. I've tried both my existing version 2.0.6 and MS latest 2.0.8.

TQ
Back to the top
 
Posted
Rating:
#111877
TQ
Avatar

Honoured member

A few more observations …

Now tried memcache.dll with updated cache_memcache.php which produced much the same error as first time around but this time with more detail.

wincache IS making about 0.5 seconds improvement to my local page load time (Firefox using 'Extended Statusbar' add-on for timings) with similar timings in Chrome, but wincache still throws an apparently random 500 error from time to time.

My server response time for the ocP home page is 3.0/3.1 seconds with a target of 200ms. It's about half that on one of the inner pages but well below 200ms on all tested Wordpress pages on the same box.

Google says a whole bunch of .js & CSS files need to be minified, what's that all about? I thought ocP minified on the fly, am I wrong?

TQ
Back to the top
 
Posted
Rating:
#111878
Avatar

which produced much the same error as first time around but this time with more detail.

Whoopsie. I had an error in the fix.

Attachment
» Download: caches_memcache.php (2 Kb, 34 downloads so far)


That said, memcache(d) is not something we actively support, as frankly I don't have the time to setup and maintain a working memcached server. That's why I prefer the other ones, no special cache server is required.

It's a shame wincache is crashing.

You could try the filesystem persistent cache. This will kick in if no appropriate PHP extension is installed (so disable the wincache and memcached(d) extensions). It does support file locking so should be stable.

APCu is another choice, but we don't support it. Let me see if I can get it working quickly though, as we do support APC and this is just a cut-down version of it.

With PHP7 the options got limited.


As for optimisation, v10 is a lot faster ;-). It's not really a very easy thing for a user to optimise a big system like ocPortal to be a fraction of the default speed, other than throwing better hardware at it. There are a lot of things that may give you 2% gains or whatever, but it's a long complex process of tradeoffs needing a lot of expertise. The types of things scanning tools mention tend to be tiny micro-optimisations compared to the CPU load required to generate portal pages. Wordpress is a much simpler system, but v10 does close the gap a lot.

I couldn't tell you exactly why if Google is saying CSS/JS aren't minified. They are. Unless it's third party ones you've tied in, or it's found like a 2% gain with some more aggressive minifier.

If you don't have Zend OpCache, I highly recommend that, as that is one of the things that really does make a bigger improvement:
PHP: OPcache - Manual
(in past times APC would be what I would of recommended, same thing – opcode  caching)


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111879
Avatar

Okay, apcu when combined with apcu-bc seems to work:
https://pecl.php.net/package/apcu_bc
https://pecl.php.net/package/APCu


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#111880
TQ
Avatar

Honoured member

Hi Chris,

Thank you for such a detailed response.

Chris said

Whoopsie. I had an error in the fix.
I will update the file but I'm going to abandon memcache as my server is primarily for ocP/Composr so I want to maintain maximum compatibility.

Chris said

It's a shame wincache is crashing.
I agree but I don't know how to analyse the problem to see if I can/could resolve it.

Chris said

As for optimisation, v10 is a lot faster
Yes, I read that, way back. Even though I've already mentioned that the upgrade puts the fear of God into me I'm actually looking forward to doing so. I also read that it won't be long now O_o

Even though my server has a 6 core CPU, has about 12GB of memory headroom & SSD drives, I'm using the 32bit version of PHP (on MS Advice) so I will always be limited as to what I can achieve. (Maybe 64 PHP is doable now, I haven't checked recently).

Chris said

I couldn't tell you exactly why if Google is saying CSS/JS aren't minified.
Hold fire on that... I've found a public site that does the same tests (probably via Google) but the results differ slightly. I will make a separate post on these results as I'm still doing the other 1%'rs.

You can look at the results here but keep in mind I can only update (rescan) my site every 24 hours and I've already made a number of changes so the current results are out of date.

Chris said

If you don't have Zend OpCache, I highly recommend that
I didn't have it enabled but it is now. I've adopted most of the config setting from the link you provided but I don't know how to examine/optimise these setting ... any pointers?

Chris said

Okay, apcu when combined with …
I tried APCu ages ago but just couldn't get it working (can't remember why) but OPcache supersedes that anyway.

Thanks again.

TQ
Back to the top
 
Posted
Rating:
#111884
Avatar

Even though my server has a 6 core CPU, has about 12GB of memory headroom & SSD drives, I'm using the 32bit version of PHP (on MS Advice) so I will always be limited as to what I can achieve. (Maybe 64 PHP is doable now, I haven't checked recently).

Generally it would be the mips of the CPU that would be best. Multiple cores is parallelism which improves performance when comparing under load, but not for single requests.

Not getting great performance was one of my regrets with ocPortal, as I designed it originally assuming Moore's law would hold for CPU speed, but the industry went the other way and held it for parallelism instead; so we had a very hard time making all the flexibility we added into the system since v2 (everything being templated, nested templates, etc) not degrade performance. We were too focused on flexibility and features, not enough on performance, frankly. v10 cracked it as we were able to find and implement a number of significant optimisations, along with doggedly going though screen-by-screen ensuring each matched a guaranteed maximum execution time.

The default Zend OpCache settings are probably fine. I'm not an expert on it.

You're confusing what APC is for. The old APC serves 2 purposes – persistent cache AND opcode cache. APCu just does the persistent cache, so it is comparable to wincache etc in your situation. I do recommend trying it.

Note that a lot of these tools are not particularly accurate in what they tell you. They may do checks for checks sake based on outdated advice, advice that isn't going to really achieve much, or stuff taken out of context or measured in poor ways.

Going through the results you posted quickly…
  • Blocking files. Something we've improved in v10, but not a huge deal. Browser's are good at parallelising requests nowadays.
  • Minification. It's the JAVASCRIPT_JQUERY.tpl template specifically, which I see on your site is marked as not to be minified. You can manually pass that template through a minifier and resave it (leave out the top few lines when passing to minify and keep them in after minifying, that's ocPortal control code not JS code).
  • A few images you could compress. I see only one is a default, and we fixed that file in v10 I think. But we're talking only about 2kb.
  • Funnily Google is saying we should configure it's own script, which we can't because it's served from their server. See what I mean about bad advice ;)?
  • Tap targets is a mobile UX thing, not a performance thing.
  • Minifying HTML is something I've considered but don't want to do because it can't be cached (each page serve is tailored to the user) and hence has a performance impact minifying it, plus I think it would hurt debugging. What the test here does not show is that gzip is going to significantly reduce the size gain it says is possible, as it overlaps significantly with what minification can achieve.


Become a fan of Composr on Facebook or add me as a friend. Add me on on Twitter. Support me on Patreon
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: