NAS540, How to stop processes?

MarkusDesk
MarkusDesk Posts: 31  Freshman Member
First Comment First Anniversary
Hello,
I think this question will be for Mijzelf.
I have a NAS540 and I am trying to use to stream my content using SMB and it is really bad(Twonky and Cloud services disabled),  so I installed the Meta Repository and Tweaks and disabled every script on Tweaks minus the one for samba and now I can see that it almost can keep up, but the video stream still get some random pauses.

Using Htop, I can see exactly when the stream pauses happens is when these processes spikes the CPU usage:
* python /usr/local/apache/we_framework/main_wsgi.pyc
* /usr/sbin/httpd -f /etc/service_conf/httpd.conf

As I can see these are responsible for the web server. What I am trying to do is to stop them and when I need to access the web config of the NAS, I could start them again.

I tried to stop them, but they start again. So how can I stop them and start when needed?

Thanks

Accepted Solution

  • Mijzelf
    Mijzelf Posts: 2,763  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    Answer ✓
    As far as I know it's the backend of the webinterface. The CGI of the webinterface communicates with it through pipes and files.

All Replies

  • Mijzelf
    Mijzelf Posts: 2,763  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    I *think* the services are automatically restarted by app_wd. But I also think you are on the wrong track. The box should be able to provide 75+MB/sec, while a media stream won't exceed 10MB, and then you have a very large stream.
    Only if samba is consuming near to 100% of the CPU cycles, it makes sense to try kill some other services.
    If your stream is stuttering, it's almost for sure a network problem. Next would be a disk problem. Have a look with dmesg, to see if there are hardware problems. When the disk is almost full, it could also be file fragmentation.
  • MarkusDesk
    MarkusDesk Posts: 31  Freshman Member
    First Comment First Anniversary
    Hi Mijzelf! Thanks for replying. Network is fine and no problem shown with dmesg. But samba does peaks about 70% to 80% CPU usage, but than the processes listed below peaks too and boom, we have stutter:
    * python /usr/local/apache/we_framework/main_wsgi.pyc
    * /usr/sbin/httpd -f /etc/service_conf/httpd.conf

    I read the app_wd link but I could not  figure out how could I create a script to start and stop above processes and how to start the system with them disabled and how to enable them when needed. I am not too good with Linux... I think it would be similar to the way you made in the Tweaks app to start without some processes. Could you please give me an example? Again, thanks.

  • Mijzelf
    Mijzelf Posts: 2,763  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    The way Tweaks disables services is different for each service. Sometimes you can simply empty the start script, sometimes you need to start a fake service because app_wd monitors the running processes and restarts a process when it's lacking. If you simply disable such a process, you end up with a system spending a lot of time starting nothing.

    In your case you could first try to find out what is accessing the webserver, and disable that. The webserver does nothing on it's own. Do you have a port forward to the webserver and are you collecting internet noise?
    When the webserver is not accessed, I don't think the python script will do anything.

    If you can't stop the webserver access, you'll have to exchange it by a fake process. One way is to mount a script on the binary. Create a script which basically does nothing:

    #!/bin/sh
    while [ true ]
    do
        sleep 1000
    done

    Make it executable:
    chmod a+x /path/to/script
    test it, and mount it on /usr/sbin/httpd:
    mount -o bind /path/to/script /usr/sbin/httpd
    Now you can restart the webserver:
    /etc/init.d/httpd.sh restart
    In htop you should see sleep as a child of httpd.

    To enable the webserver again, stop the fake script:
    killall httpd
    unmount the binary
    umount /usr/sbin/httpd
    and start the webserver
    /etc/init.d/httpd.sh start
    (Or wait until app_wd does it for you)


  • MarkusDesk
    MarkusDesk Posts: 31  Freshman Member
    First Comment First Anniversary
    Hi, thanks again for relying. When I get home will test it. Regarding the process:
    * python /usr/local/apache/we_framework/main_wsgi.pyc

    Is it part of the httpd? If not, how should I stop it?

  • Mijzelf
    Mijzelf Posts: 2,763  Guru Member
    250 Answers 2500 Comments Friend Collector Seventh Anniversary
    Answer ✓
    As far as I know it's the backend of the webinterface. The CGI of the webinterface communicates with it through pipes and files.
  • MarkusDesk
    MarkusDesk Posts: 31  Freshman Member
    First Comment First Anniversary
    Hi Mijzelf, thank you very much for you attention and all information. I am not in my hometown these days, but as soon as I get home I will test everything!!
  • MarkusDesk
    MarkusDesk Posts: 31  Freshman Member
    First Comment First Anniversary
    Hello, sorry for the delay, but I made a lot of tests. Now I am able to stream SMB without stuttering. Here is what I made:
    1- Installed Mijzelf Tweaks and disabled everything, except Samba.
    2- Enabled flow control in my managed switch on the NAS540 port and on my player's port.
    3- Used the LAN 2 connector of the NAS540. Tested on 2 different units.

    I know it sounds weird, but it works perfectly. I also have a second NAS540 and these settings also work on it! If any of the steps above are not followed, it will have some stuttering.

    And as always, than kyou Mijzelf for all information!

Consumer Product Help Center