[squid-users] Question: cache_mem share among multiple squid instances with the same service_name in SMP mode
Alex Rousskov
rousskov at measurement-factory.com
Mon May 20 14:09:18 UTC 2024
On 2024-05-20 03:35, Zhijian Li (Fujitsu) wrote:
> In SMP mode, is it possible that cache_mem can be share among
> multiple squid instances with the same service_name?
Short answer: "Do not run multiple SMP Squid instances with the same
service_name".
SMP Squid cache[1] is not supposed to be shared across Squid instances.
Any configurations or actions that result in such sharing are
unsupported and may lead to undefined behavior. Squid may not emit
warnings or other diagnostics in such unsupported cases -- no Squid code
has been written specifically to detect and warn about unsupported
memory sharing.
For example, running multiple identically-built Squid instances on the
same "box"[2] with the _same_ service name is unsupported and may lead
to undefined behavior, especially if SMP Squid cache[1] is enabled.
Running multiple identically-built Squid instances on the same "box"[2]
with _different_ service names is supported on some OSes because it does
not lead to unsupported sharing. In other environments, it may lead to
undefined behavior. This limitation is a Squid bug or a missing feature.
Developers wishing to remove this limitation should look at
shm_portable_segment_name_is_path() description and use case.
[1]: Here, "SMP Squid cache" applies to both cache_dir storage (on disk
and in shared memory) and cache_mem storage (in shared memory). Very
similar reasoning applies to non-caching SMP Squid instances as well,
but the question was about caching, so I will not detail these other cases.
[2]: Here, the term "box" is used to mean "isolation environment": "Same
box" means the same OS instance, the same container instance (if
containerized), and the same filesystem (i.e. no chroot, jails, or
similar isolation tricks for each Squid instance). Various OSes isolate
shared memory segments differently, but many use file systems for some
shared memory artifacts. If artifacts from different Squid instances
clash, Squid behavior is undefined.
HTH,
Alex.
>
> Per SmpScale[1], "memory object cache (in most environments)" can be share among workers
> Per smp-enabled-squid[2], "Each set of SMP-aware processes will interact only with other processes using the same service name"
>
> So if i have multiple (SMP mode + same service_name) squid instances, would they share the cache_mem objects.
>
> [1] https://wiki.squid-cache.org/Features/SmpScale#what-can-workers-share
> [2] https://wiki.squid-cache.org/KnowledgeBase/MultipleInstances#smp-enabled-squid
>
>
> Thanks
> Zhijian
> _______________________________________________
> squid-users mailing list
> squid-users at lists.squid-cache.org
> https://lists.squid-cache.org/listinfo/squid-users
More information about the squid-users
mailing list