Question

I have a Linux CENTOS server that is very low on its resources (consider for example an AWS MicroInstance). I have on this server 3 PHP Applications and MySQL Server instance running. I require to run multiple recurring jobs for my application that requires to send emails, cleanup process and generate thumbnails. I do not want to slow down the server. Would it be right to run my task as a CRON or as a JAR built using Java in this scenario or should I look at something entirely outside this server?

Was it helpful?

Solution

As I commented, Use cron thru a crontab entry, perhaps with nice.

I don't believe that making a Java program which would mostly sleep and runs indefinitely for that purpose is a good idea: it will use resources (swap space, processes). And it could be more brittle: if that Java process would stop (for any reason), you won't find out.

If your Java program is rather small and follow some old specification of the language, you might even consider compiling it ahead-of-time perhaps with gcj into a small ELF executable.

OTHER TIPS

Java is pretty heavy on resources. You can do all the things you want using cron and bash except the thumnail generation. There are lots of apps for thumbnail generation like cthumb but I have not used any of them. It might be simpler to use ImageMagick directly.

This will likely have the least impact on resources. Whether there will be enough resources is another question and depending on how often you want to be doing this, it is likely that you will.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top