[opencms-dev] Fwd: Too frequent flex cache cleaning problem

Enrico Marongiu enrico.marongiu at gmail.com
Mon Jan 11 18:43:19 CET 2016


Hi Alexandre,
we've just implemented varnish on our dev environment, so take it as a
first-order approximation to the problem :) (Quick and dirty setup)



 here are the rules I call in vcl_recv:

8x----8x---cut-here 8x----8x---

sub vcl_recv {
  call workplace_area;
  call opencms_req;
  #... other rules
}


# prepend /opencms when necessary (we are working with quasi-standard
setup, replacing apache httpd with varnish)
sub opencms_req {
        if (req.url !~ "(^/export|^/resources|^/webdav)") {
            set req.url = regsub(req.url, "^", "/opencms");
        }
}

# intercept all requests directed to the workplace AND the offline
workplace site
sub workplace_area {
        if (req.url~"^/system/"){
                set req.http.X-Workplace="true";
                set req.url=regsub(req.url,"^","/opencms");
                return (pass);
        }
        if (req.http.host ~ "your.workplace.site.tld" ){

                set req.http.X-Workplace="true";
                call opencms_req;
                return (pass);
        }
}


8x----8x---cut-here 8x----8x---


Hope it helps.
Cheers,
Enrico

2016-01-11 18:15 GMT+01:00 Alexandre Portugal Sousa <
alexandre.portugal at almg.gov.br>:

>   Hi, Enrico.
>
>   I'm also installing Varnish here. But I'm facing a problem: because of
> the cache, workplace logged in users cannot see their modifications on jsp
> pages (offline projects).
>
>   How did you deal with that? How Varnish can distinguish workplace users
> requests (which cannot be cashed) from normal users requests (which can be
> cashed) ?
>
>    Thanks!
>
> -------- Mensagem original -------- Assunto: [opencms-dev] Too frequent
> flex cache cleaning problem Data: Mon, 11 Jan 2016 15:03:57 -0200 De: enrico.marongiu
> at gmail.com
> <opencms-dev%40opencms.org?Subject=Re%3A%20%5Bopencms-dev%5D%20Too%20frequent%20flex%20cache%20cleaning%20problem&In-Reply-To=%3CCAPMdg48hszRFeAFWats%2B2Wbr2Ppcp_GEySR7LYb7Q%2B152KDHWQ%40mail.gmail.com%3E> Para:
> opencms-dev at opencms.org
>
> Hi Alexandre,
> Please consider that flex cache is cleaned for every publish event.
> If you browse the list history (or google for it) you'll find that flex
> cache cannot be informed of al the resources that change after a publish,
> I.e. if you publish a template or an included jsp, all the cached resources
> that are rendered with that jsp must be cleaned.
> We worked around this by putting a varnish layer in front of opencms and
> configuring jsps so that they return the "appropriate" cache directives.
>
> Cheers,
> Enrico
> Il 15/dic/2015 20:08, "Alexandre Portugal Sousa" <alexandre.portugal at almg.gov.br <http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev>> ha scritto:
>
> >*   Hi.
> *>>*   I cannot understand the flex cache behavior of my server...  Long before
> *>* current memory use reaches the maximal, the cache is cleaned.
> *>>*   How <maxkeys> relates to 'files' and 'variations'? Could it explain
> *>* somehow the "early-cleaning" problem?
> *>>*   Here's my config:
> *>>* <flexcache>
> *>*             <cache-enabled>true</cache-enabled>
> *>*             <cache-offline>false</cache-offline>
> *>*             <maxcachebytes>80000000</maxcachebytes>
> *>*             <avgcachebytes>60000000</avgcachebytes>
> *>*             <maxentrybytes>4000000</maxentrybytes>
> *>*             <maxkeys>5000</maxkeys>
> *>*         </flexcache>
> *>>*   And here's the flex cache status right before being cleaned (I'm sure
> *>* you don't need to understand portuguese):
> *>>>>*    Thanks!
> *>
>
> --
> Atenciosamente,
>
> *Alexandre Portugal Sousa*
> GTI - Gerência-Geral de Tecnologia da Informação
> GGov - Gerência de Governo Eletrônico
> alexandre.portugal at almg.gov.br
> (31) 2108-7025
>
>
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
>
>
>
>
>


-- 

[image: Enrico Marongiu on about.me]

Enrico Marongiu
about.me/cernio
skype: cerionmorgauin
  <http://about.me/cernio>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20160111/bfd4e0df/attachment.htm>


More information about the opencms-dev mailing list