2

so essentially I have a Drupal website with great performance for anonymous users and terrible performance for logged in users.

What I am looking for is a way to serve some pages that logged in users access as if they were an anonymous user.

In custom development this would be done using a:

cache-control:public

header for varnish, but obviously when viewing that page anything such as the users profile information and the login status must not be shown so its not cached in varnish.

I was hoping there would be a config change or module that could perform this without having to write a custom module,

any ideas would be greatly appreciated

6
  • 1
    Do you have the internal caching modules enabled? Are you using additional cache mechanisms like memcache or redis?
    – Kevin
    Jun 20, 2018 at 16:27
  • Have you looked at the Big Pipe module for Drupal 8 (assuming that the site in question is Drupal 8)? Jun 20, 2018 at 17:04
  • For a low level solution like the one you've mentioned in custom development you could add $response->headers->set('Cache-Control', 'public'); in a response subcriber and in the same subscriber remove the user related content from $response->getContent().
    – 4uk4
    Jun 21, 2018 at 13:33
  • @Kevin I'm using authcache with memcached but the performance vs varnish is significantly slower. With varnish I can handle well over 2000 simultaneous users, with authcache and memcached I struggle with more than 100 users
    – Simon
    Jun 21, 2018 at 23:47
  • @ScottJoudry sorry forgot to mention the site in question is drupal 7, but always interested in solutions for drupal 8 sites
    – Simon
    Jun 21, 2018 at 23:47

1 Answer 1

0

You may implement ESI block caching.

Have a look at ESI module and varnish basic tutorial. You would be able then to cache whole pages except the blocks with session data.

Additionally, @Kevin comment points a complementary way: using Redis or Memcache will substantially speed the pages when logged, by caching data and objects in server memory to reduce the number of times the data source must be read.

2
  • Obviously this will be open to interpretation but how does this compare with authcache in terms of performance for logged in users? If it has superior performance I would be very interested in moving away from authcache.
    – Simon
    Jun 21, 2018 at 23:56
  • I don't know, implement both and benchmark it ;). More seriously, there are several combinations of caching methods, I use Varnish for anon and redis for logged and it blazingly fasten websites, even with complex edit forms....
    – Kojo
    Jun 22, 2018 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.