dimanche 8 mars 2015

'nc' using ~100% CPU when transferring a FIFO file


On the server which is always connected I’m using this in a crontab:



@reboot nc -k -l 1234 < /tmp/fifo.fifo


On the client which is not always on the network or switched on I’m using this command:



nc -d $IP_OF_SERVER 1234 > /tmp/fifo.fifo & $SOME_COMMAND


The server listens always for a connection on the specified port (thanks to the -k parameter), the client just connects to the server when it needs to.


I’m using this for MPD and its FIFO visualizer. MPD runs on a remote host, but my MPD client (ncmpcpp) runs locally.


This is the important part of the ncmpcpp config on the local host:



mpd_host = "$IP_OF_SERVER"
visualizer_fifo_path = "/tmp/fifo.fifo"


This is the important part of the mpd config on the remote server:



audio_output {
[…]
path "/tmp/fifo.fifo"
[…]
}


Running the 'nc' command on my local machine seems to use a very high amount of resources … ~100% of my CPU performance.


Any ideas where the problem is? Or if this is normal and how I would improve this whole scenario?


Unfortunately it’s not possible to just specify a network-path for visualizer_fifo_path, like:



visualizer_fifo_path = "$http://IP_OF_SERVER:/tmp/fifo.fifo"


And it’s also not possible to mount the remote host via NFS and then use the FIFO which is mounted via NFS.



Aucun commentaire:

Enregistrer un commentaire