<div dir="ltr"><div>Hi Alexandre,</div><div>we've just implemented varnish on our dev environment, so take it as a first-order approximation to the problem :) (Quick and dirty setup)</div><div><br></div><div><br></div><div> </div><div> here are the rules I call in vcl_recv:</div><div><br></div><div>8x----8x---cut-here 8x----8x---<br></div><div><br></div><div>sub vcl_recv {</div><div>  call workplace_area;</div><div>  call opencms_req;</div><div>  #... other rules</div><div>}</div><div><br></div><div><br></div><div># prepend /opencms when necessary (we are working with quasi-standard setup, replacing apache httpd with varnish)</div><div>sub opencms_req {</div><div>        if (req.url !~ "(^/export|^/resources|^/webdav)") {</div><div>            set req.url = regsub(req.url, "^", "/opencms");</div><div>        }</div><div>}</div><div><br></div><div># intercept all requests directed to the workplace AND the offline workplace site</div><div>sub workplace_area {</div><div>        if (req.url~"^/system/"){</div><div>                set req.http.X-Workplace="true";</div><div>                set req.url=regsub(req.url,"^","/opencms");</div><div>                return (pass);</div><div>        }</div><div>        if (req.http.host ~ "your.workplace.site.tld" ){</div><div><br></div><div>                set req.http.X-Workplace="true";</div><div>                call opencms_req;</div><div>                return (pass);</div><div>        }</div><div>}</div><div><br></div><div><br></div><div>8x----8x---cut-here 8x----8x---</div><div><br></div><div><br></div><div>Hope it helps. </div><div>Cheers,</div><div>Enrico</div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-11 18:15 GMT+01:00 Alexandre Portugal Sousa <span dir="ltr"><<a href="mailto:alexandre.portugal@almg.gov.br" target="_blank">alexandre.portugal@almg.gov.br</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  

    
  
  <div text="#000000" bgcolor="#FFFFFF">
      Hi, Enrico.<br>
    <br>
      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).<br>
    <br>
      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) ?<br>
    <div><br>
         Thanks!<br>
      <br>
      -------- Mensagem original --------
      <table border="0" cellpadding="0" cellspacing="0">
        <tbody>
          <tr>
            <th nowrap valign="BASELINE" align="RIGHT">Assunto:
            </th>
            <td>[opencms-dev] Too frequent flex cache cleaning problem</td>
          </tr>
          <tr>
            <th nowrap valign="BASELINE" align="RIGHT">Data: </th>
            <td>Mon, 11 Jan 2016 15:03:57 -0200</td>
          </tr>
          <tr>
            <th nowrap valign="BASELINE" align="RIGHT">De: </th>
            <td><a href="mailto: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" title="[opencms-dev] Too frequent flex cache cleaning
                problem" style="font-family:'Times New Roman';font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">enrico.marongiu at
                gmail.com<span> </span></a></td>
          </tr>
          <tr>
            <th nowrap valign="BASELINE" align="RIGHT">Para: </th>
            <td><a href="mailto:opencms-dev@opencms.org" target="_blank">opencms-dev@opencms.org</a><br>
            </td>
          </tr>
        </tbody>
      </table>
      <br>
      
      <pre style="white-space:pre-wrap;color:rgb(0,0,0);font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:normal;text-align:start;text-indent:0px;text-transform:none;word-spacing:0px">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" <
<a href="http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev" target="_blank">alexandre.portugal at almg.gov.br</a>> ha scritto:

><i>   Hi.
</i>><i>
</i>><i>   I cannot understand the flex cache behavior of my server...  Long before
</i>><i> current memory use reaches the maximal, the cache is cleaned.
</i>><i>
</i>><i>   How <maxkeys> relates to 'files' and 'variations'? Could it explain
</i>><i> somehow the "early-cleaning" problem?
</i>><i>
</i>><i>   Here's my config:
</i>><i>
</i>><i> <flexcache>
</i>><i>             <cache-enabled>true</cache-enabled>
</i>><i>             <cache-offline>false</cache-offline>
</i>><i>             <maxcachebytes>80000000</maxcachebytes>
</i>><i>             <avgcachebytes>60000000</avgcachebytes>
</i>><i>             <maxentrybytes>4000000</maxentrybytes>
</i>><i>             <maxkeys>5000</maxkeys>
</i>><i>         </flexcache>
</i>><i>
</i>><i>   And here's the flex cache status right before being cleaned (I'm sure
</i>><i> you don't need to understand portuguese):
</i>><i>
</i>><i>
</i>><i>
</i>><i>    Thanks!
</i>></pre><span class="HOEnZb"><font color="#888888">
      <div>-- <br>
        Atenciosamente, <br>
        <br>
        <b>Alexandre Portugal Sousa</b> <br>
        GTI - Gerência-Geral de Tecnologia da Informação <br>
        GGov - Gerência de Governo Eletrônico <br>
        <a href="mailto:alexandre.portugal@almg.gov.br" target="_blank">alexandre.portugal@almg.gov.br</a>
        <br>
        (31) 2108-7025 <br>
      </div>
      <br>
    </font></span></div>
    <br>
  </div>

<br>_______________________________________________<br>
This mail is sent to you from the opencms-dev mailing list<br>
To change your list options, or to unsubscribe from the list, please visit<br>
<a href="http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev" rel="noreferrer" target="_blank">http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev</a><br>
<br>
<br>
<br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><a href="http://about.me/cernio" style="margin:0px;padding:0px;border:0px;outline:0px;font-size:14px;font-family:proxima-nova-1,proxima-nova-2,Tahoma,Helvetica,Verdana,sans-serif;vertical-align:baseline;color:rgb(43,130,173);text-decoration:none;line-height:18.200000762939453px" target="_blank"><table border="0" cellpadding="0" cellspacing="0" style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline;border-spacing:0px"><tbody style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><tr style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><td colspan="3" style="padding:0px;border:0px;outline:0px;font-style:inherit;font-size:0px;font-family:inherit;vertical-align:baseline;height:30px"> </td></tr><tr style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><td align="left" valign="top" style="padding:0px;border:0px;outline:0px;font-style:inherit;font-family:inherit;vertical-align:top;line-height:1"><div style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><img src="http://d3mod6n032mdiz.cloudfront.net/thumb2/c/e/r/cernio/cernio-105x70.jpg" alt="Enrico Marongiu on about.me" width="96" height="64" style="margin:0px;padding:0px;border:1px solid rgb(238,238,238);outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline;display:block"></div></td><td style="padding:0px;border:0px;outline:0px;font-style:inherit;font-size:0px;font-family:inherit;vertical-align:baseline;width:10px"> </td><td align="left" valign="bottom" style="padding:0px 0px 3px;border:0px;outline:0px;font-style:inherit;font-family:inherit;vertical-align:bottom;line-height:1"><div style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:bold;font-style:inherit;font-size:18px;font-family:proxima-nova-1,Proxima-Nova,Helvetica,Arial,sans-serif;vertical-align:baseline;line-height:1;color:rgb(51,51,51)">Enrico Marongiu</div><div style="margin:1px 0px 0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:12px;font-family:proxima-nova-1,Proxima-Nova,Helvetica,Arial,sans-serif;vertical-align:baseline">about.me/cernio</div><div style="margin:1px 0px 0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-size:12px;font-family:proxima-nova-1,Proxima-Nova,Helvetica,Arial,sans-serif;vertical-align:baseline">skype: cerionmorgauin</div></td></tr><tr style="margin:0px;padding:0px;border:0px;outline:0px;font-weight:inherit;font-style:inherit;font-family:inherit;vertical-align:baseline"><td colspan="3" style="padding:0px;border:0px;outline:0px;font-style:inherit;font-size:0px;font-family:inherit;vertical-align:baseline;height:20px"> </td></tr></tbody></table></a></div></div>
</div>