opnsense / core

OPNsense GUI, API and systems backend
https://opnsense.org/
BSD 2-Clause "Simplified" License
3.23k stars 721 forks source link

squid: option for adding workers via GUI #2777

Closed falcon78921 closed 5 years ago

falcon78921 commented 5 years ago

Here's my setup:

OPNsense 18.7.4-amd64
FreeBSD 11.1-RELEASE-p14
OpenSSL 1.0.2p 14 Aug 2018

I'm running OPNSense on an AMD Ryzen 7 1700X Eight-Core Processor (16 cores) and 16GB of RAM.

I'm having oddities with Squid that might be process related. I know Squid uses worker processes in order to balance ops. I'm trying to add more workers because I see only one squid process in the top output.

For example:

last pid: 51610;  load averages:  0.40,  0.46,  0.49                                                                                                                                       up 3+20:37:29  09:25:33
245 processes: 2 running, 243 sleeping
CPU:  2.6% user,  0.0% nice,  0.2% system,  0.2% interrupt, 97.0% idle
Mem: 4032M Active, 7445M Inact, 1810M Wired, 1135M Buf, 2572M Free
Swap: 8192M Total, 8192M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
29080 squid         1  83    0 12307M 10674M CPU12  12 787:49  45.31% squid
25255 root          1  20    0  1053M  3100K bpf     8   7:38   0.42% filterlog
71428 root          1  20    0  1051M  2964K select  0   4:04   0.23% syslogd
69167 root          1  20    0 22124K  5028K select 13   2:17   0.06% top
20610 root          1  20    0 22124K  4752K CPU5    5   0:00   0.05% top
39478 squid         1  20    0  1074M  4812K piperd  7   0:11   0.02% unlinkd
80359 squid         1  20    0  1074M  5808K select 11   0:01   0.01% pinger
14259 root          1  20    0   103M 31388K select 15   2:01   0.00% python2.7
72492 root          1  20    0  1091M  6680K select  3   0:13   0.00% sshd
30653 root          1  20    0  1049M  5960K select  9   0:11   0.00% ntpd
93056 root          1  20    0  1091M  7600K select  3   0:00   0.00% sshd
31124 root          1  20    0 51708K  9364K kqread 15   0:10   0.00% lighttpd
72645 squid         1  20    0  1074M  5816K select 14   0:00   0.00% pinger
80853 squid         1  20    0  1074M  5808K select  6   0:00   0.00% pinger
21686 squid         1  20    0  1074M  5808K select 15   0:00   0.00% pinger
86147 squid         1  20    0  1074M  5808K select  8   0:00   0.00% pinger
18940 squid         1  20    0  1074M  5812K select 12   0:00   0.00% pinger
46359 squid         1  20    0  1074M  5804K select 10   0:00   0.00% pinger
23321 squid         1  20    0  1074M  5812K select  1   0:01   0.00% pinger
54101 squid         1  20    0  1074M  5808K select 15   0:01   0.00% pinger
47600 squid         1  20    0  1074M  5808K select  6   0:00   0.00% pinger
34699 squid         1  20    0  1074M  5108K select  3   0:02   0.00% pinger
81962 squid         1  20    0  1074M  5108K select 15   0:02   0.00% pinger
53580 squid         1  20    0  1074M  5812K select  2   0:00   0.00% pinger
85679 squid         1  20    0  1074M  5808K select  0   0:00   0.00% pinger
57939 squid         1  20    0  1074M  5812K select 14   0:02   0.00% pinger
67026 squid         1  20    0  1074M  5108K select  7   0:02   0.00% pinger
 6511 squid         1  20    0  1074M  5116K select 14   0:02   0.00% pinger
74298 squid         1  20    0  1074M  5112K select 12   0:02   0.00% pinger
50533 squid         1  20    0  1074M  5808K select  1   0:01   0.00% pinger
79982 squid         1  20    0  1074M  5808K select 11   0:01   0.00% pinger
10986 squid         1  20    0  1074M  5804K select  3   0:00   0.00% pinger
54870 squid         1  20    0  1074M  5816K select  0   0:00   0.00% pinger
78223 squid         1  20    0  1074M  5116K select 14   0:02   0.00% pinger
 2231 squid         1  20    0  1074M  5120K select  7   0:02   0.00% pinger

I added a workers option in the /usr/local/etc/squid/squid.conf, but it gets wiped out (I know you're not supposed to add manual entries, but I was desperate). Is there a way to add more workers in the squid.conf via the OPNSense GUI? Am I missing something? Thanks!

AdSchellevis commented 5 years ago

you can try your options using pre/post-auth plugins in https://github.com/opnsense/core/blob/master/src/opnsense/service/templates/OPNsense/Proxy/squid.conf

If you post the parts you've added and past them here, we can take a look if we can add it to the options. It sounds useful, but I'm unsure if only setting workers is enough here.