<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> On 4/03/19 5:39 pm, George Xie wrote:<br>> > hi all:<br>> ><br>> > Squid version: 3.5.23-5+deb9u1<br>> > Docker version 18.09.3, build 774a1f4<br>> > Linux instance-4 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27)<br>> > x86_64 GNU/Linux<br>> ><br>> > I have the following squid config:<br>> ><br>> ><br>> >     http_port <a href="http://127.0.0.1:3128">127.0.0.1:3128</a><br>> >     cache deny all<br>> >     access_log none<br>> ><br>> What is it exactly that you think this is doing in regards to Squid<br>> memory needs?<br>><br></blockquote><div><br></div><div>sorry, I don't get your quest.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> ><br>> > runs in a container with following Dockerfile:<br>> ><br>> >     FROM debian:9<br>> >     RUN apt update && \<br>> >     apt install --yes squid<br>> ><br>> ><br>> > the total memory of the host server is very low, only 592m, about 370m<br>> > free memory.<br>> > if I start squid in the container, squid will abort immediately.<br>> ><br>> > error messages in /var/log/squid/cache.log:<br>> ><br>> ><br>> >     FATAL: xcalloc: Unable to allocate 1048576 blocks of 392 bytes!<br>> ><br>> >     Squid Cache (Version 3.5.23): Terminated abnormally.<br>> >     CPU Usage: 0.012 seconds = 0.004 user + 0.008 sys<br>> >     Maximum Resident Size: 47168 KB<br>> ><br>> ><br>> > error message captured with strace -f -e trace=memory:<br>> ><br>> >     [pid   920] mmap(NULL, 411176960, PROT_READ|PROT_WRITE,<br>> >     MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)<br>> ><br>> ><br>> > it appears that squid (or glibc) tries to allocate 392m memory, which is<br>> > larger than host free memory 370m.<br>> > but I guess squid don't need that much memory, I have another running<br>> > squid instance, which only uses < 200m memory.<br>> No doubt it is configured to use less memory. For example by reducing<br>> the default memory cache size.<br>><br></blockquote><div><br></div><div>that running squid instance has the same config.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> > the oddest thing is if I run squid on the host (also Debian 9) directly,<br>> > not in the container, squid could start and run as normal.<br>> ><br>> Linux typically allows RAM over-allocation. Which works okay so long as<br>> there is sufficient swap space and there is time between memory usage to<br>> do the swap in/out process.<br>> Amos<br></blockquote><div><br></div><div>swap is disabled in the host server, so do in the container. </div><div><br></div><div>after all, I wonder why squid would try to claim 392m memory if don't need that much.</div><div><br></div><div>XieShi</div></div></div></div></div>