<div dir="ltr">No no, with Varnish open-source you really want all your stuff in memory anyway. What I meant is really to have two storages based on object size.<div><br></div><div>Imagine you have a 50MB object that needs to be stored, and your nuke_limit is 50.</div><div><br></div><div>If you only have one store, then you could easily evict 50 100KB objects, forcing you to fail the transaction.</div><div><br></div><div>But if you have a pool that is dedicated to bigger objects, you know that each object you evict from it is at least 1MB big, so you cannot fail the transaction due to nuke_limit<br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>-- <br></div>Guillaume Quintard<br></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 8, 2020 at 11:50 AM Batanun B <<a href="mailto:batanun@hotmail.com">batanun@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
ok. Interesting. <span id="gmail-m_-7645081767654884713🙂">🙂</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span><br>
</span></div>
<div><font color="#000000" face="Calibri, Helvetica, sans-serif"><span style="font-size:12pt">99.99% of the time that this is happening (after adjusting the cache sizes), I would say that it would be only a single user requesting the image. So it
would make sense it it was possible to configure Varnish so it could handle that scenario in a better way. What happens when multiple users request the same resource, and this nuke problem happens is less of a problem, and those times a broken could be acceptable
(but preferably it would start serving each request </span>separately<span style="font-size:12pt">, uncached, fetching from the backend each time).</span></font></div>
<div><font color="#000000" face="Calibri, Helvetica, sans-serif"><span style="font-size:12pt"><br>
</span></font></div>
<div><font color="#000000" face="Calibri, Helvetica, sans-serif"><span style="font-size:12pt">I will increase the cache size, and look into splitting it into two storages. But, I'm guessing you mean that the small objects should be cached in-memory,
and the larger ones on disk? It would make much more sense if it cached less "popular" objects on disk, and more "popular" objects in memory, and only considering the object size when the in-memory cache starts to get full. Is it possible to configure Varnish
to handle that in a smart and dynamic way?</span></font></div>
<div id="gmail-m_-7645081767654884713appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-7645081767654884713divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Guillaume Quintard <<a href="mailto:guillaume@varnish-software.com" target="_blank">guillaume@varnish-software.com</a>><br>
<b>Sent:</b> Friday, May 8, 2020 8:33 PM<br>
<b>To:</b> Batanun B <<a href="mailto:batanun@hotmail.com" target="_blank">batanun@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a> <<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a>><br>
<b>Subject:</b> Re: Varnish intermittently returns incomplete images</font>
<div>Â </div>
</div>
<div>
<div dir="ltr">Good question. This is because by default varnish streams the response, so it starts sending what it has, even though it's unsure it can actually deliver. When the eviction strikes, it just aborts the transaction.
<div><br>
</div>
<div>The problem with "just" passing the data to the user is that there may be more than one and things get really complicated.</div>
<div><br>
</div>
<div>Getting a bigger cache would help, and segregating the storages (smaller than 1MB, and bigger than 1MB for example) would too<br clear="all">
<div>
<div dir="ltr">
<div dir="ltr">
<div>-- <br>
</div>
Guillaume Quintard<br>
</div>
</div>
</div>
<br>
</div>
</div>
<br>
<div>
<div dir="ltr">On Fri, May 8, 2020 at 11:28 AM Batanun B <<a href="mailto:batanun@hotmail.com" target="_blank">batanun@hotmail.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
also... could you explain this part for me? "<span style="color:rgb(32,31,30);font-size:15px;background-color:rgb(255,255,255);display:inline">so it had to truncate it and throw it away"</span></div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<span style="color:rgb(32,31,30);font-size:15px;background-color:rgb(255,255,255);display:inline">Why does it have to truncate it? Why not avoid caching it, and returning it as is, from the backend, untouched?</span></div>
<div id="gmail-m_-7645081767654884713x_gmail-m_2763874099659638374appendonsend"></div>
<hr style="display:inline-block;width:98%">
<div id="gmail-m_-7645081767654884713x_gmail-m_2763874099659638374divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Guillaume Quintard <<a href="mailto:guillaume@varnish-software.com" target="_blank">guillaume@varnish-software.com</a>><br>
<b>Sent:</b> Friday, May 8, 2020 7:34 PM<br>
<b>To:</b> Batanun B <<a href="mailto:batanun@hotmail.com" target="_blank">batanun@hotmail.com</a>><br>
<b>Cc:</b> <a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a> <<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a>><br>
<b>Subject:</b> Re: Varnish intermittently returns incomplete images</font>
<div>Â </div>
</div>
<div>
<div dir="ltr">Hi,
<div><br>
</div>
<div>Do you have objects that are sensibly smaller that your images in your cache?</div>
<div><br>
</div>
<div>What you are describing sounds like LRU failure (check nuke_limit in "varnishadm param.show"), basically, on a miss, varnish couldn't evict enough objects and make room for the new object, so it had to truncate it and throw it away.</div>
<div><br>
</div>
<div>If that's the issue, you can increase nuke_limit, or get a bigger cache, or segregate small and large objects into different storages.</div>
<div><br clear="all">
<div>
<div dir="ltr">
<div dir="ltr">
<div>-- <br>
</div>
Guillaume Quintard<br>
</div>
</div>
</div>
<br>
</div>
</div>
<br>
<div>
<div dir="ltr">On Fri, May 8, 2020 at 10:14 AM Batanun B <<a href="mailto:batanun@hotmail.com" target="_blank">batanun@hotmail.com</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Our Varnish (test environment)Â intermittently returns incomplete images. So the binary content is not complete. When requesting the image from the backend directly (using curl), the complete image is returned every time (I tested 1000 times using a script).</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
This happens intermittently. Sometimes Varnish returns the complete image, sometimes half of it, sometimes 20% etc... The incomplete image is returned quickly, so I don't think there is a timeout involved (we have not configured any specific timeout in varnish).</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
I see nothing special in varnishlog when this happens. But I don't know how to troubleshoot this in a good way. Any suggestions?</div>
</div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote>
</div>
</div>
</div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote>
</div>
</div>
</div>
_______________________________________________<br>
varnish-misc mailing list<br>
<a href="mailto:varnish-misc@varnish-cache.org" target="_blank">varnish-misc@varnish-cache.org</a><br>
<a href="https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc" rel="noreferrer" target="_blank">https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc</a><br>
</blockquote></div>