In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
As a developer, the crudest and most straightforward solution to the problem of not being able to schedule tasks is crontab. Of course, crontab efficiency is relatively high and convenient when there are few machines, few tasks, and few associations between scheduled tasks. However, when there are more machines, more scheduled tasks, and more closely related tasks, it will be very confusing to use crontab to manage and configure scheduled tasks, which will seriously affect work efficiency.
With multiple machines and multiple scheduled tasks, the following problems will be encountered:
1. The crontab task management under each user of each server is chaotic, and the life cycle cannot be unified and coordinated.
2. It is difficult to unify the alarm of abnormal operation of scheduled tasks.
3. If task A and task B are mutually exclusive, crontab is difficult to handle mutually exclusive.
4. With the increase of time, when the number of timed tasks reaches thousands and tens of thousands, the timed tasks are very difficult to manage, and multiple timed tasks are run online. When each timed task runs, which application belongs to and which development is responsible for it becomes difficult to solve.
Linux native Crontab scheduling system vs. Quartz:
1. Execution granularity:
Crontab: Process Scheduling
Quartz: thread scheduling
Thread scheduling advantages: one is more resource-saving, and the other is that data exchange can be done within the process, which is very important.
2. Platform dependencies:
Crontab supports Linux systems
Quartz is implemented in Java, so it supports cross-platform.
3. On the scheduling operation set:
Quartz settings are more flexible, can be very convenient through the code to complete a variety of custom requirements, and complete closure Crontab.
However, the minimum scheduling unit of Crontab is minute level, while Quartz can be finer. It is troublesome for Crontab to implement custom requirements.
4. Job monitoring:
Quartz supports Listener, which is very convenient for job running monitoring, and JobStores can be used to persist scheduling information (memory, DB can be), and then job visualization can be realized.
5. High availability:
Quartz supports distributed clustering, which is important and easy to implement.
Why use distributed cluster task scheduling?
Imagine that there are now 3 machines A, B, and C serving as cluster servers at the same time. Each of the 3 machines has a QUARTZ Job, and they will automatically perform their respective tasks according to the scheduled schedule. Since QUARTZ is present in all three SERVER, TASK is processed repeatedly. The general solution is to install QUARTZ on only one server, and the other two are not installed. In this case, it is actually a stand-alone server. Quartz will have a single-point problem. Once the server with quartz is down, the service cannot be provided. Of course, this can also be achieved by changing the code of QUARTZ JOB, but this is more demanding for developers, and other problems may arise. Quartz itself, however, provides a good clustering solution. Quartz clusters require database support (JobStore TX or JobStore CMT), which essentially enables every node in the cluster to work by sharing the same database to achieve high availability. Quartz is a good choice for distributed cluster task scheduling. Simple, powerful, stable.
One problem with distributed clustering is that all server clocks should be synchronized to avoid bizarre and unpredictable problems.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.