squid doesn't cache objects in memory when using SMP and shared memory cache

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

squid doesn't cache objects in memory when using SMP and shared memory cache

Ivan Larionov
Hello!

After migrating squid from non-SMP/aufs to SMP/rock memory cache hit ratio dropped significantly. Like from 50-100% to 1-5%. And disk cache hit ratio went up from 15-50% to stable 60-65%. From the brief log file check it looks like in SMP/rock mode squid avoids using memory for small files like 1-3KB but uses it for 10KB+ files.

I started tracking down the issue with disabling disk cache completely and it didn't change anything, I just started to get MISS every time for the URL which was getting MEM_HIT with an old configuration. Then I changed "workers 2" to "workers 1" and started getting memory hits as before.

So it seems like the issue is with shared memory:

When squid doesn't use shared memory it works as expected. Even with multiple workers.
When squid uses shared memory it caches very small amount of objects.

Am I doing anything wrong? Which debug options should I enable to provide more information if it seems like a bug?

Config diff:

--- squid.conf.old  2018-01-14 02:01:19.000000000 -0800
+++ squid.conf.new  2018-01-14 02:01:16.000000000 -0800
@@ -1,5 +1,8 @@
 http_port 0.0.0.0:3128
 
+workers 2
+cpu_affinity_map process_numbers=1,2 cores=1,2
+
 acl localnet src 10.0.0.0/8     # RFC1918 possible internal network
 acl localnet src 172.16.0.0/12  # RFC1918 possible internal network
 acl localnet src 192.168.0.0/16 # RFC1918 possible internal network
@@ -94,13 +97,12 @@
 
 never_direct allow all
 
-cache_mem 9420328 KB
-maximum_object_size_in_memory 32 KB
+cache_mem 12560438 KB
+maximum_object_size_in_memory 64 KB
 memory_replacement_policy heap LRU
 cache_replacement_policy heap LRU
 
-cache_dir aufs /mnt/services/squid/cache/cache0 261120 16 256
-cache_dir aufs /mnt/services/squid/cache/cache1 261120 16 256
+cache_dir rock /mnt/services/squid/cache 522240 swap-timeout=500 max-swap-rate=1200 slot-size=16384
 
 minimum_object_size 64 bytes # none-zero so we dont cache mistakes
 maximum_object_size 102400 KB


All relevant config options together (SMP/rock):

workers 2
cpu_affinity_map process_numbers=1,2 cores=1,2

cache_mem 12560438 KB
maximum_object_size_in_memory 64 KB
memory_replacement_policy heap LRU
cache_replacement_policy heap LRU

cache_dir rock /mnt/services/squid/cache 522240 swap-timeout=500 max-swap-rate=1200 slot-size=16384

minimum_object_size 64 bytes # none-zero so we dont cache mistakes
maximum_object_size 102400 KB

negative_ttl 0 seconds
range_offset_limit none


Squid version:

Squid Cache: Version 3.5.27
Service Name: squid
configure options:  '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/sbin' '--sbindir=/usr/sbin' '--sysconfdir=/etc/squid' '--libdir=/usr/lib' '--libexecdir=/usr/lib/squid' '--includedir=/usr/include' '--datadir=/usr/share' '--sharedstatedir=/usr/com' '--localstatedir=/var' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--enable-epoll' '--enable-removal-policies=heap,lru' '--enable-storeio=aufs,rock' '--enable-delay-pools' '--with-pthreads' '--enable-cache-digests' '--with-large-files' '--with-maxfd=16384' '--enable-htcp'

--
With best regards, Ivan Larionov.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Amos Jeffries
Administrator
On 15/01/18 18:53, Ivan Larionov wrote:
> Hello!
>
> After migrating squid from non-SMP/aufs to SMP/rock memory cache hit
> ratio dropped significantly. Like from 50-100% to 1-5%. And disk cache
> hit ratio went up from 15-50% to stable 60-65%. From the brief log file
> check it looks like in SMP/rock mode squid avoids using memory for small
> files like 1-3KB but uses it for 10KB+ files.

AIUI, SMP-mode rock operates as a fully separate process (a "Disker"
kid) which delivers its results as objects already in shared memory to
the worker process.

There should be little or no gain from that promotion process anymore -
which would only be moving the object between memory locations. In fact
if cache_mem were not operating as shared memory even with SMP active
(which is possible) the promotion would be an actively bad idea as it
prevents other workers using the object in future.

They show up as non- MEM_HIT because they are either REFRESH or stored
in the Disker shared memory instead of the cache_mem shared memory. The
Squid logging is not quite up to recording the slim distinction between
which of multiple memory areas are being used.


>
> I started tracking down the issue with disabling disk cache completely
> and it didn't change anything, I just started to get MISS every time for
> the URL which was getting MEM_HIT with an old configuration. Then I
> changed "workers 2" to "workers 1" and started getting memory hits as
> before.
>
> So it seems like the issue is with shared memory:
>
> When squid doesn't use shared memory it works as expected. Even with
> multiple workers.
> When squid uses shared memory it caches very small amount of objects.
>
> Am I doing anything wrong? Which debug options should I enable to
> provide more information if it seems like a bug?
>

Are you seeing an actual performance difference? if not I would not
worry about it.

FYI: if you really want to track this down I suggest using Squid-4 to do
that. Squid-3 is very near the end of its support lifetime and changes
of a deep nature do not have much chance at all of getting in there now.

Amos
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Alex Rousskov
In reply to this post by Ivan Larionov
On 01/14/2018 10:53 PM, Ivan Larionov wrote:

> After migrating squid from non-SMP/aufs to SMP/rock memory cache hit
> ratio dropped significantly. Like from 50-100% to 1-5%.

This could be a side effect of not supporting Vary caching in shared
memory: https://bugs.squid-cache.org/show_bug.cgi?id=3806#c9


> And disk cache hit ratio went up from 15-50% to stable 60-65%.

I hope your total/combined hit ratio improved overall.


> it looks like in SMP/rock mode squid avoids using memory for small
> files like 1-3KB but uses it for 10KB+ files.

No, there is no such size-discrimination code in Squid.


> I started tracking down the issue with disabling disk cache completely
> and it didn't change anything, I just started to get MISS every time for
> the URL which was getting MEM_HIT with an old configuration. Then I
> changed "workers 2" to "workers 1" and started getting memory hits as
> before.

For a clean apples-to-apples test, make sure you use
"memory_cache_shared on" when using a single worker without rock cache_dirs.


> Am I doing anything wrong? Which debug options should I enable to
> provide more information if it seems like a bug?


Vary caching should be fixed as well, of course, but perhaps there is
another problem we do not know about. I would start by eliminating Vary
as the known problem. When using a test transaction, make sure the
response does not have a Vary header. Or configure Squid to log the Vary
header and remove the corresponding transactions when computing
adjusted-for-Vary memory cache hit ratio.


HTH,

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Alex Rousskov
In reply to this post by Amos Jeffries
On 01/15/2018 08:22 AM, Amos Jeffries wrote:

> AIUI, SMP-mode rock operates as a fully separate process (a "Disker"
> kid) which delivers its results as objects already in shared memory
> to the worker process.

Yes, disk hits are delivered to workers via shared memory, but...


> There should be little or no gain from that promotion process anymore -

I disagree: A disk hit is still a lot slower than a memory hit because a
disk hit involves reading from a disk, which is a major performance
bottleneck.

The shared memory pages used to deliver disk hits to workers are then
reused for delivering other disk hits. Those pages are not a part of a
cache. Ideally, those pages could be added to (swapped with) the memory
cache pages (to avoid memory copying; when other conditions are met),
but Squid does not have the code to do that yet. We do not even have the
code to serve hits from shared memory -- we copy the bytes from shared
to local memory first.

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Ivan Larionov
In reply to this post by Amos Jeffries
My disks are fast (SSD) so I didn't see performance issues but it doesn't change the fact that memory hit ratio decreased in more than 10 times. And with both rock and shared memory cache enabled most of the files were saved into disk cache and not into memory cache and most of the hits were disk hits (according to log file).

I already tried squid 4 and it works as expected.

So. Let's forget about rock because the issue I see is related to shared memory. For my test file with only memory cache enabled:

squid 3.5.27 non-SMP - MISS first then always MEM_HIT
squid 3.5.27 SMP any amount of workers shared memory off - always MEM_HIT after all workers handled the request once
squid 3.5.27 SMP any amount of workers shared memory on - MISS every time.
squid 4.0.22 SMP 2 workers shared memory on - MISS first then always MEM_HIT

I would like to use squid 4 in production and I probably will since looks like SMP/shared_cache is broken in 3, but the fact that you still haven't released it confuses me. IDK why it's still in beta/rc/whatever stage.

On Mon, Jan 15, 2018 at 7:22 AM, Amos Jeffries <[hidden email]> wrote:
On 15/01/18 18:53, Ivan Larionov wrote:
Hello!

After migrating squid from non-SMP/aufs to SMP/rock memory cache hit ratio dropped significantly. Like from 50-100% to 1-5%. And disk cache hit ratio went up from 15-50% to stable 60-65%. From the brief log file check it looks like in SMP/rock mode squid avoids using memory for small files like 1-3KB but uses it for 10KB+ files.

AIUI, SMP-mode rock operates as a fully separate process (a "Disker" kid) which delivers its results as objects already in shared memory to the worker process.

There should be little or no gain from that promotion process anymore - which would only be moving the object between memory locations. In fact if cache_mem were not operating as shared memory even with SMP active (which is possible) the promotion would be an actively bad idea as it prevents other workers using the object in future.

They show up as non- MEM_HIT because they are either REFRESH or stored in the Disker shared memory instead of the cache_mem shared memory. The Squid logging is not quite up to recording the slim distinction between which of multiple memory areas are being used.



I started tracking down the issue with disabling disk cache completely and it didn't change anything, I just started to get MISS every time for the URL which was getting MEM_HIT with an old configuration. Then I changed "workers 2" to "workers 1" and started getting memory hits as before.

So it seems like the issue is with shared memory:

When squid doesn't use shared memory it works as expected. Even with multiple workers.
When squid uses shared memory it caches very small amount of objects.

Am I doing anything wrong? Which debug options should I enable to provide more information if it seems like a bug?


Are you seeing an actual performance difference? if not I would not worry about it.

FYI: if you really want to track this down I suggest using Squid-4 to do that. Squid-3 is very near the end of its support lifetime and changes of a deep nature do not have much chance at all of getting in there now.

Amos
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users



--
With best regards, Ivan Larionov.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Ivan Larionov
In reply to this post by Alex Rousskov
My total hit ratio decreased in ~2 times from 40% to 20% (it could be cold cache but it lasted at this level for a day without sign of improvement).

I'll retry tests with making sure there're no Vary header and will also try 1 worker with shared cache tomorrow. But even if it is this bug looks like caching works as expected in squid 4 so it'll be better solution than messing up with headers probably.

On Mon, Jan 15, 2018 at 10:26 AM, Alex Rousskov <[hidden email]> wrote:
On 01/14/2018 10:53 PM, Ivan Larionov wrote:

> After migrating squid from non-SMP/aufs to SMP/rock memory cache hit
> ratio dropped significantly. Like from 50-100% to 1-5%.

This could be a side effect of not supporting Vary caching in shared
memory: https://bugs.squid-cache.org/show_bug.cgi?id=3806#c9


> And disk cache hit ratio went up from 15-50% to stable 60-65%.

I hope your total/combined hit ratio improved overall.


> it looks like in SMP/rock mode squid avoids using memory for small
> files like 1-3KB but uses it for 10KB+ files.

No, there is no such size-discrimination code in Squid.


> I started tracking down the issue with disabling disk cache completely
> and it didn't change anything, I just started to get MISS every time for
> the URL which was getting MEM_HIT with an old configuration. Then I
> changed "workers 2" to "workers 1" and started getting memory hits as
> before.

For a clean apples-to-apples test, make sure you use
"memory_cache_shared on" when using a single worker without rock cache_dirs.


> Am I doing anything wrong? Which debug options should I enable to
> provide more information if it seems like a bug?


Vary caching should be fixed as well, of course, but perhaps there is
another problem we do not know about. I would start by eliminating Vary
as the known problem. When using a test transaction, make sure the
response does not have a Vary header. Or configure Squid to log the Vary
header and remove the corresponding transactions when computing
adjusted-for-Vary memory cache hit ratio.


HTH,

Alex.



--
With best regards, Ivan Larionov.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Alex Rousskov
On 01/15/2018 09:25 PM, Ivan Larionov wrote:

> looks like caching works as expected in squid 4 so it'll be better
> solution than messing up with headers probably.

FYI: Vary caching in shared memory is not supported in any Squid
version, including v4.

Alex.


> On Mon, Jan 15, 2018 at 10:26 AM, Alex Rousskov wrote:
>
>     On 01/14/2018 10:53 PM, Ivan Larionov wrote:
>
>     > After migrating squid from non-SMP/aufs to SMP/rock memory cache hit
>     > ratio dropped significantly. Like from 50-100% to 1-5%.
>
>     This could be a side effect of not supporting Vary caching in shared
>     memory: https://bugs.squid-cache.org/show_bug.cgi?id=3806#c9
>     <https://bugs.squid-cache.org/show_bug.cgi?id=3806#c9>
>
>
>     > And disk cache hit ratio went up from 15-50% to stable 60-65%.
>
>     I hope your total/combined hit ratio improved overall.
>
>
>     > it looks like in SMP/rock mode squid avoids using memory for small
>     > files like 1-3KB but uses it for 10KB+ files.
>
>     No, there is no such size-discrimination code in Squid.
>
>
>     > I started tracking down the issue with disabling disk cache completely
>     > and it didn't change anything, I just started to get MISS every time for
>     > the URL which was getting MEM_HIT with an old configuration. Then I
>     > changed "workers 2" to "workers 1" and started getting memory hits as
>     > before.
>
>     For a clean apples-to-apples test, make sure you use
>     "memory_cache_shared on" when using a single worker without rock
>     cache_dirs.
>
>
>     > Am I doing anything wrong? Which debug options should I enable to
>     > provide more information if it seems like a bug?
>
>
>     Vary caching should be fixed as well, of course, but perhaps there is
>     another problem we do not know about. I would start by eliminating Vary
>     as the known problem. When using a test transaction, make sure the
>     response does not have a Vary header. Or configure Squid to log the Vary
>     header and remove the corresponding transactions when computing
>     adjusted-for-Vary memory cache hit ratio.
>
>
>     HTH,
>
>     Alex.
>
>
>
>
> --
> With best regards, Ivan Larionov.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Alex Rousskov
In reply to this post by Ivan Larionov
On 01/15/2018 09:25 PM, Ivan Larionov wrote:
> My total hit ratio decreased in ~2 times from 40% to 20%

>     On 01/14/2018 10:53 PM, Ivan Larionov wrote:
>
>     > After migrating squid from non-SMP/aufs to SMP/rock memory cache hit
>     > ratio dropped significantly. Like from 50-100% to 1-5%.
>
>     > And disk cache hit ratio went up from 15-50% to stable 60-65%.


The combination of the three statements above may be a sign of a problem
unrelated to Vary: Since the disk cache can cache everything the memory
cache can and is typically much larger than the memory cache, the
incapacitation of a memory cache (due to Vary) should not have a
significant effect on overall hit ratio. It should only affect hit
response time.

The only known culprit I can think of in this context are hits for
being-cached objects: Rock lacks code that allows Squid to read
being-written objects. The shared memory cache has that code already. If
your workload has a lot of cases where clients request a being-written
object, then the overall hit ratio should go down after the memory cache
incapacitation (due to Vary).

I suspect something else is in play here though, especially if you see a
different picture with Squid v4 -- the known problem discussed above is
present in all Squid versions. I second Amos's recommendation to focus
on v4 because it is unlikely that any complicated problems are going to
be fixed in v3, even if you triage them well.


HTH,

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Amos Jeffries
Administrator
In reply to this post by Ivan Larionov
On 16/01/18 17:18, Ivan Larionov wrote:
>
> I would like to use squid 4 in production and I probably will since
> looks like SMP/shared_cache is broken in 3, but the fact that you still
> haven't released it confuses me. IDK why it's still in beta/rc/whatever
> stage.

FYI:
<https://squidproxy.wordpress.com/2016/07/01/whats-going-on-with-squid-4/>.
The situation has not changed much since July except that the bugs are
now down to just 2 with one of those also nearly completed.

The bug which is nearly fixed
(<https://bugs.squid-cache.org/show_bug.cgi?id=4505>) is about cache
removals not working properly across multiple storage areas. So the fix
which is soon to go in for that may also have an impact on your situation.

Amos
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Ivan Larionov
In reply to this post by Alex Rousskov
So it's definitely not related to Vary, there's no such header in requests I tried. Also this issue affects squid even with 1 worker if shared memory is forced to on.

Interesting thing I noticed is that according to log file a lot of images are actually cached in memory but sound files are not (mp3/wav). It's not like it makes any sense but how about random example url:


squid 4, 2 workers, shared cache, no disk cache – MEM_HIT
squid 3, same config – MISS every time
squid 3, no shared cache – MEM_HIT

Could you do a brief test with this URL may be and confirm that I'm not the only one who see this issue?

On Tue, Jan 16, 2018 at 6:25 AM, Alex Rousskov <[hidden email]> wrote:
On 01/15/2018 09:25 PM, Ivan Larionov wrote:
> My total hit ratio decreased in ~2 times from 40% to 20%

>     On 01/14/2018 10:53 PM, Ivan Larionov wrote:
>
>     > After migrating squid from non-SMP/aufs to SMP/rock memory cache hit
>     > ratio dropped significantly. Like from 50-100% to 1-5%.
>
>     > And disk cache hit ratio went up from 15-50% to stable 60-65%.


The combination of the three statements above may be a sign of a problem
unrelated to Vary: Since the disk cache can cache everything the memory
cache can and is typically much larger than the memory cache, the
incapacitation of a memory cache (due to Vary) should not have a
significant effect on overall hit ratio. It should only affect hit
response time.

The only known culprit I can think of in this context are hits for
being-cached objects: Rock lacks code that allows Squid to read
being-written objects. The shared memory cache has that code already. If
your workload has a lot of cases where clients request a being-written
object, then the overall hit ratio should go down after the memory cache
incapacitation (due to Vary).

I suspect something else is in play here though, especially if you see a
different picture with Squid v4 -- the known problem discussed above is
present in all Squid versions. I second Amos's recommendation to focus
on v4 because it is unlikely that any complicated problems are going to
be fixed in v3, even if you triage them well.


HTH,

Alex.



--
With best regards, Ivan Larionov.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Alex Rousskov
On 01/16/2018 02:40 PM, Ivan Larionov wrote:
> So it's definitely not related to Vary, there's no such header in
> requests I tried.

Just to avoid misunderstanding, please note that Vary is a response header.


> Also this issue affects squid even with 1 worker if
> shared memory is forced to on.

This matches the current suspicion that there is something wrong with
the shared memory cache (in your environment).

> It's not like it makes any sense but how about random example url:
>
> http://techslides.com/demos/samples/sample.mp3
>
> squid 4, 2 workers, shared cache, no disk cache – MEM_HIT
> squid 3, same config – MISS every time
> squid 3, no shared cache – MEM_HIT
>
> Could you do a brief test with this URL may be and confirm that I'm not
> the only one who see this issue?

I cannot confirm that: In primitive wget tests with Squid v3.5 (bzr
r14182), I am getting shared memory hits with the above URL, with or
without cache_dirs, with or without SMP.

Alex.


> On Tue, Jan 16, 2018 at 6:25 AM, Alex Rousskov wrote:
>
>     On 01/15/2018 09:25 PM, Ivan Larionov wrote:
>     > My total hit ratio decreased in ~2 times from 40% to 20%
>
>     >     On 01/14/2018 10:53 PM, Ivan Larionov wrote:
>     >
>     >     > After migrating squid from non-SMP/aufs to SMP/rock memory cache hit
>     >     > ratio dropped significantly. Like from 50-100% to 1-5%.
>     >
>     >     > And disk cache hit ratio went up from 15-50% to stable 60-65%.
>
>
>     The combination of the three statements above may be a sign of a problem
>     unrelated to Vary: Since the disk cache can cache everything the memory
>     cache can and is typically much larger than the memory cache, the
>     incapacitation of a memory cache (due to Vary) should not have a
>     significant effect on overall hit ratio. It should only affect hit
>     response time.
>
>     The only known culprit I can think of in this context are hits for
>     being-cached objects: Rock lacks code that allows Squid to read
>     being-written objects. The shared memory cache has that code already. If
>     your workload has a lot of cases where clients request a being-written
>     object, then the overall hit ratio should go down after the memory cache
>     incapacitation (due to Vary).
>
>     I suspect something else is in play here though, especially if you see a
>     different picture with Squid v4 -- the known problem discussed above is
>     present in all Squid versions. I second Amos's recommendation to focus
>     on v4 because it is unlikely that any complicated problems are going to
>     be fixed in v3, even if you triage them well.
>
>
>     HTH,
>
>     Alex.
>
>
>
>
> --
> With best regards, Ivan Larionov.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Ivan Larionov
Yeah I meant Very in response to requests I tried.

The fact that you can't reproduce it with this url and the fact that it affects mostly mp3/wav files gave me an idea.

Our env specific is squid's cache_peer parent which transcodes audio files to ulaw (format which our backend supports). This explains why audio files. Doesn't explain why it works with squid 3 non-shared memory and squid 4 shared-memory.

I verified direct request and memory cache works with squid 3 +shared memory.

The difference between direct and non-direct (transcoded) response for http://techslides.com/demos/samples/sample.mp3:

* "Content-Type: audio/mpeg" for direct, "Content-Type: audio/ulaw" for non-direct.
* No "Content-Length" header for non-direct.

What do you think? Could these 2 points lead to the issue I see? Why does it work in all situations except squid 3 + shared memory?

On Tue, Jan 16, 2018 at 3:17 PM, Alex Rousskov <[hidden email]> wrote:
On 01/16/2018 02:40 PM, Ivan Larionov wrote:
> So it's definitely not related to Vary, there's no such header in
> requests I tried.

Just to avoid misunderstanding, please note that Vary is a response header.


> Also this issue affects squid even with 1 worker if
> shared memory is forced to on.

This matches the current suspicion that there is something wrong with
the shared memory cache (in your environment).

> It's not like it makes any sense but how about random example url:
>
> http://techslides.com/demos/samples/sample.mp3
>
> squid 4, 2 workers, shared cache, no disk cache – MEM_HIT
> squid 3, same config – MISS every time
> squid 3, no shared cache – MEM_HIT
>
> Could you do a brief test with this URL may be and confirm that I'm not
> the only one who see this issue?

I cannot confirm that: In primitive wget tests with Squid v3.5 (bzr
r14182), I am getting shared memory hits with the above URL, with or
without cache_dirs, with or without SMP.

Alex.


> On Tue, Jan 16, 2018 at 6:25 AM, Alex Rousskov wrote:
>
>     On 01/15/2018 09:25 PM, Ivan Larionov wrote:
>     > My total hit ratio decreased in ~2 times from 40% to 20%
>
>     >     On 01/14/2018 10:53 PM, Ivan Larionov wrote:
>     >
>     >     > After migrating squid from non-SMP/aufs to SMP/rock memory cache hit
>     >     > ratio dropped significantly. Like from 50-100% to 1-5%.
>     >
>     >     > And disk cache hit ratio went up from 15-50% to stable 60-65%.
>
>
>     The combination of the three statements above may be a sign of a problem
>     unrelated to Vary: Since the disk cache can cache everything the memory
>     cache can and is typically much larger than the memory cache, the
>     incapacitation of a memory cache (due to Vary) should not have a
>     significant effect on overall hit ratio. It should only affect hit
>     response time.
>
>     The only known culprit I can think of in this context are hits for
>     being-cached objects: Rock lacks code that allows Squid to read
>     being-written objects. The shared memory cache has that code already. If
>     your workload has a lot of cases where clients request a being-written
>     object, then the overall hit ratio should go down after the memory cache
>     incapacitation (due to Vary).
>
>     I suspect something else is in play here though, especially if you see a
>     different picture with Squid v4 -- the known problem discussed above is
>     present in all Squid versions. I second Amos's recommendation to focus
>     on v4 because it is unlikely that any complicated problems are going to
>     be fixed in v3, even if you triage them well.
>
>
>     HTH,
>
>     Alex.
>
>
>
>
> --
> With best regards, Ivan Larionov.




--
With best regards, Ivan Larionov.

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: squid doesn't cache objects in memory when using SMP and shared memory cache

Alex Rousskov
On 01/16/2018 04:59 PM, Ivan Larionov wrote:

> The difference between direct and non-direct (transcoded) response
> for http://techslides.com/demos/samples/sample.mp3:

> * No "Content-Length" header for non-direct.

I suspect that "recent" Squid changes improved handling of responses
with unknown size. IIRC, there were several changes in that area. I bet
not all of them were backported to v3.

Alex.
_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users