I have a question about job schedular, can use crontab(linux) command replace java quartz?
I want to know the advantage of quartz, someone could give some advice.
Depending on the scale of the problem being solved, using the cron scheduler provided by Linux will work well for many problems (on a single host). When you would like some fail over capability quartz is going to be the solution. Quartz can act as a clustered scheduler. Configured correctly, one node could be brought down for patching while the jobs running on quartz continue to process. There are also features of quartz that cron does not provide. Persistence and disallowing concurrent execution are two that I am using for a project. Those are some of the features that stand out to me. It would be best to check the documentation and look at some of the examples provided.
Cron is available by default on any unix based os. Quarz is simply a Java API with (more scheduling options). If you wish to schedule tasks within a Java application, Quartz is the way to go. If you wish to schedule adhoc os commands, unless you feel like writing your own generic scheduler, cron is the way to go.
Related
I'm building a system in Kotlin that need's to schedule a lot of jobs at the same time (sometimes even a few thousands of jobs). Most of the jobs are not complex, they are simply doing a few HTTP requests with different libraries.
I'm currently working with Quartz scheduler. the problem is that sometimes it misfires a job and that something that can be critical to me. I know Quartz has different settings you can apply to handle misfires but I didn't find something suitable.
I know that in Kotlin there are coroutines that can be considered as lightweight threads. Is there any scheduler like Quartz for Kotlin that executes the jobs as coroutines instead of threads with the same (or at least most of the same) features? I'm asking because I believe that such scheduler can increase my system performance.
follow up question: if such scheduler exists will it be safe to use him even if I don't know the implementation of the libraries I'm using inside the job? (For example making sure there are no Thread.sleep() calls)
I have an issue currently where I've got a cron job set to run at midnight each day to reset daily API requests for a service that I run. The job failed recently which caused me a whole bunch of headaches and I've been trying to find a solution to monitor all of my cron jobs so I don't have a situation like this happen again.
I haven't been able to find a sufficient solution however, and in response I am considering creating a platform that allows you to monitor cron jobs, see logs (and past logs), last run date, failure/success of the last run, etc... in real-time and would notify you if your job hasn't completed within a specified window of time or the job failed.
I believe this might be a pain point and a good solution for others as well.
What are you thoughts? Do you think that this would be useful, have any suggestions, or just think this would be a waste of time?
Did you hear about Rundeck? (https://www.rundeck.com/open-source)
It looks like it's exactly what you're looking for.
You install it on a server, and it's like a Web UI for a crontab.
You define jobs you want to run using the Web UI, how often you want them to run and you can see some history of the past executions, their status and their output. You can also see when the next execution will happen.
I think there are also some alerting features to notify you if a job is on failure. I'm not sure if it can notify you based on the job execution time though.
This might be a good fit for what you're looking for.
2 years later, I am asking myself exactly the same questions ) Definitely you should have created such service already, haven't you? Every backend coder needs this time from time, in theory. I'm surprised this question hasn't received enough activity/voting. I got an answer leading to this though: https://uptimerobot.com/cron-job-monitoring/ that might be a good solution. Need to test it out. It does not seem to be promoted enough, as it's not easy to find. Also there is https://cronitor.io/docs/cron-job-monitoring that has ability to transmit (somewhat limited) telemetry data, +a lot of SDKs to be used from within programming languages.
Hi i am having an application which needs to be scheduled in order to perform a task continuously, but i am doing the development on IBM Bluemix cloud and after like 10 days of research i have not been able to find a correct solution to implement a QUARTZ or CRON scheduler in bluemix, in a web application.
whatever i have found out is a service inside the BLuemix called as Workload scheduler but no success has been obtained so far from the steps mentioned there.
Secondly i have found a blog where there are some steps posted to implement scheduler in bluemix, but no success from that as well, the link is mentioned below.
Link: http://sureshgarrepalli.blogspot.in/2015_08_01_archive.html
If anyone here can help me regarding this would be a lot of help. Thanks.
I am using java as my technology and would like to prefer QUARTZ scheduler over CRONJOB.
If someone would be having a snippet of working code, it will be of great help. Thanks
have you considered using OpenWhisk, which has the capability for triggering logic on a scheduled fashion?
See here for details: https://console.ng.bluemix.net/docs/openwhisk/openwhisk_alarms.html#openwhisk_catalog_alarm
can you add more details on what you want to do? If you want one of your restful services to be invoked, the workload scheduler service will help.
If you want to have a workflow with steps spanning across different systems, monitor the execution of these steps from a user interface, be notified if anything goes wrong etc etc, the workload scheduler service will be your first choice.
Thanks, Umberto
I understand that startup tasks are used to set up your system. For example, if your code is written in Python, you can add a startup task to install Python. But can't this also be done in the ProgramEntryPoint batch script? What's the difference?
Its true that, if you use the ProgramEntryPoint there doesn't seem to be a reason to use startup tasks. You can indeed include all the logic in that same batch file.
Startup tasks get more useful when working with the .NET WebRoles/WorkerRoles. There you only have the option to write code (where you could again call a single batch file calling other batch files) and or use startup tasks.
But if you look at it from a maintenance point of view its much cleaner to use startup tasks for everything having to do with configuration and installation of your instance. You draw a clear line between configuration/installation and your actual application - you could actually see this as separation of concerns (this will be easy to understand be other/new developers on the project).
Besides that you have to know that, when you use tasks, you can execute tasks in different contexts (limited / elevated) which might be important from a security perspective. And tasks exist in different types (simple, background, foreground) which can be used in many different scenarios (a background app that constantly pings your site for example). If you don't use tasks, you might need to handle all of this yourself.
Here is a good blog post covering the details of startup tasks: Using Startup Task in Windows Azure detailed summary
Great answer from Sandrino. In a nutshell - you would use startup tasks if you want some code to execute (or start executing) before your role starts. If that is not a constraint you can always execute any process (including batch scripts) from the OnStart method of the Role. One case where I have used startup tasks in the past is to install the NewRelic monitoring agent. I wanted that running to profile my app before the actual app started.
You will probably not be able to install Python from the ProgramEntryPoint since the install will probably require elevated ("admin") privilegies.
A role (web/worker) usually does not have elevated privilegies (it might be possible but it is a bad practice for obvious security reasons). So code in ProgramEntryPoint does not have elevated privilegies.
On another hand, a startup task can have elevated privilegies. IMO, this probably the biggest (single ?) benefit from using startup tasks.
I have noticed a lot of people discussing Gearman and it's scheduling features making it enable to distribute work onto other servers. However, I have not yet seen a comparison to native cronjobs.
What are the differences between cron and Gearman?
If you're doing pure scheduling, using Gearman is unnecessary.
The main differences between Gearman and cron are that:
cron jobs are only triggered only based on time, while Gearman functions are triggered by calls by other applications.
Gearman is used for coordinating tasks between multiple systems, as you mentioned, while cron provides no synchronization. As a result, asynchronous tasks are better for cron, and vice versa.
Unless your application needs to farm out heavy-duty synchronous processing to other servers, I would recommend you to use cron and keep it simple.