Page 1 of 1

Service taking too much CPU

Posted: Mon Feb 17, 2020 12:44 pm
by zeesh1979
Hi,
I am using Raspberry Pi 3B+. I configured Alexa SD (avs-sdk) on that. if i run the sample app via terminal, top shows the cpu utilization of sample app is around 30-40%. but when i run the same app as service or any other method to start at boot, top shows cpu utlization of same sample app more than 120%. i can not understand why?bcoz of this, pi kills the alexa process and it no more runs. at this stage if i run sample app again via terminal, top shows same 30-40% utlization. below is how i run at after boot (startsample.sh is alexa sample app):

sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart

Code: Select all

@xscreensaver -no-splash  # comment this line out to disable screensaver
@xset s off
@xset -dpms
@xset s noblank
@chromium-browser --incognito --kiosk http://localhost:8000
@sudo bash /home/pi/startsample.sh
and below is how i make it a service and run it :

sudo nano /lib/systemd/system/alexa.service

Code: Select all

[Unit]
Description=alexaservice
After=network-online.target
Requires=network-online.target
[Service]
ExecStart=/bin/bash /home/pi/startsample.sh
Restart=always
[Install]
WantedBy=multi-user.target

Re: Service taking too much CPU

Posted: Mon Feb 17, 2020 1:49 pm
by topguy
Any chance you are starting it twice? Both as the service and as autostart ?