Skip to content

Python as a daemon?

michaelgv profile image Mike github logo ・1 min read

I have a unique situation where I need to run a daemon that will interact with Salt and Docker, naturally my thought process is Python, however I’m not sure if Python is the best case or something like C or Go is better?

It doesn’t need to be cross platform, strictly is responsible for syncing up our CDN and software repositories


twitter logo DISCUSS (4)
markdown guide

I think small daemons can be written in any language if performance isn't a huge concern. I write little Ruby daemons all the time, to perform monitoring tasks etc. when I can be decently sure my program isn't leaking memory or anything like that.

I'll either run them as periodically-executed Cron scripts, or just make them infinite-looping programs. Both approaches have worked fine for me.


True, but it doesn’t answer the fundemential question, of which tecchnology is better for the lightweight daemon


So performance is a concern for you ? Definitely python, depending on what you're doing will take some memory upfront. It easy to take up to 50MB even just for a simple program but at the same time it quite stable. It seldom leak memory (but if it did, quite challenging to troubleshoot). So if by lightweight you mean something that can run in just 1MB or less, definitely not python.

At the same time, all our daemons (processing tasks from database, responding to file system events, processing http webhooks, connecting to tcp socket of external application) are using python with daemontools and it's running fine for years.

Classic DEV Post from Apr 18

Google Chrome’s new update finally allows you to organize and group tabs!

Google Chrome’s new update finally allows you to organize tabs easily

Mike profile image
Full-time freelancer; Former Lead Engineer / Senior Management; speaker; 14 years in development; open for consulting and freelance opportunities.