On Thu, 29 Jun 2017, Jan Henning Thorsen wrote:
> Hey,
>
> It doesn't look like "daemon" mode. It looks like you used "morbo" to start
> the application.
I don't know what makes you say that. I definitely was using "daemon" mode
and was not using "morbo".
I didn't track down exactly what code was making the difference in the
poll timeout, but worked out that it was somewhere in the CGI plugin. I've
eliminated the CGI plugin and now find that the poll timeout is back to
1000 ms, which a corresponding reduction in idle CPU.
I don't know exactly where the fork() was which lead to the pair of
processes. I did have some code with an open() reading from a pipe, but I
wouldn't expect to see poll() in the child process in that case.
Mystery not quite solved, but now that I am not using the CGI plugin I at
least don't have an ongoing problem.
Thanks for commenting. If you want to try to identify the problem with the
CGI plugin I can re-insert that code.
>
>
> On Wednesday, June 14, 2017 at 11:11:31 PM UTC+2, Charlie Brady wrote:
> >
> >
> > I'm running a Mojolicious UI in daemon mode on a PowerPC embedded system
> > (running Wind River Linux, perl 5.22.0, kernel 4.1.21) and notice
> > surprisingly high CPU usage on a totally idle UI.
> >
> > I can see that there are two processes. Each process is in a polling loop
> > with 10ms timeout. I don't expect to see two processes here, so I wonder
> > whether this is normal or abnormal behaviour. If it is normal behaviour,
> > can I tune down the 10ms timeout to something longer? I would like to see
> > the process block until there is actual work to do.
> >
> > root@10:/service# ps fax | grep index.daemon-5
> > 1418 pts/1 S+ 0:00 \_ grep index.daemon
> > 19303 ? Ssl 24:24 /etc/e-smith/web/functions/index.daemon.cgi
> > 24397 ? Ssl 20:54 \_ /etc/e-smith/web/functions/index.daemon.cgi
> > root@10:/service# strace -p19303 -tt 2>&1 | head -5
> > Process 19303 attached
> > 17:05:08.095154 restart_syscall(<... resuming interrupted call ...>) = 0
> > 17:05:08.104465 poll([{fd=21, events=POLLIN|POLLPRI|POLLOUT}], 1, 9) = 0
> > (Timeout)
> > 17:05:08.116478 poll([{fd=21, events=POLLIN|POLLPRI|POLLOUT}], 1, 10) = 0
> > (Timeout)
> > 17:05:08.130120 poll([{fd=21, events=POLLIN|POLLPRI|POLLOUT}], 1, 9) = 0
> > (Timeout)
> > root@10:/service# strace -p24397 -tt 2>&1 | head -5
> > Process 24397 attached
> > 17:05:12.888643 restart_syscall(<... resuming interrupted call ...>) = 0
> > 17:05:12.894814 poll([{fd=21, events=POLLIN|POLLPRI|POLLOUT}], 1, 10) = 0
> > (Timeout)
> > 17:05:12.908082 poll([{fd=21, events=POLLIN|POLLPRI|POLLOUT}], 1, 10) = 0
> > (Timeout)
> > 17:05:12.920771 poll([{fd=21, events=POLLIN|POLLPRI|POLLOUT}], 1, 10) = 0
> > (Timeout)
> > root@10:/service# top | head -12
> > top - 17:09:31 up 9 days, 7:59, 4 users, load average: 0.73, 0.59, 0.60
> > Tasks: 98 total, 1 running, 95 sleeping, 0 stopped, 2 zombie
> > %Cpu(s): 12.9 us, 5.7 sy, 3.8 ni, 75.7 id, 1.8 wa, 0.0 hi, 0.1 si,
> > 0.0 st
> > KiB Mem : 995536 total, 5428 free, 317100 used, 673008
> > buff/cache
> > KiB Swap: 65532 total, 65448 free, 84 used. 594360 avail Mem
> >
> > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
> >
> > 1440 root 20 0 3852 2280 1924 R 24.0 0.2 0:00.13 top
> >
> > 508 root 20 0 134908 69156 13896 S 12.0 6.9 465:50.05
> > call_control
> > 19303 root 20 0 87812 37720 4148 S 8.0 3.8 24:45.37
> > /etc/e-smith/we
> > 24397 root 20 0 87788 37184 3552 S 8.0 3.7 21:13.65
> > /etc/e-smith/we
> > 425 root 20 0 16068 10284 3640 S 4.0 1.0 33:32.22 snmpd
> >
> >
>