# qes **Repository Path**: qwsone/qes ## Basic Information - **Project Name**: qes - **Description**: 基于事件流的调度系统 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-04-17 - **Last Updated**: 2024-04-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Quartz-Event-Scheduler ## performance 内存 比 jdbc快 1000x以上 RamJobStore org.quartz.simpl.RAMJobStore JdbcJobStore org.quartz.impl.jdbcjobstore.JobStoreTX ### 优化jdbc How do I improve the performance of JDBC-JobStore? There are a few known ways to speed up JDBC-JobStore, only one of which is very practical. First, the obvious, but not-so-practical: 1. Buy a better (faster) network between the machine that runs Quartz, and the machine that runs your RDBMS. 2. Buy a better (more powerful) machine to run your database on. 3. Buy a better RDBMS. Now for something simple, but effective: Build indexes on the Quartz tables. Most database systems will automatically put indexes on the primary-key fields, many will also automatically do it for the foreign-key field. Make sure yours does this, or make the indexes on all key fields of every table manually. Next, manually add some additional indexes: most important to index are the TRIGGER table’s "next_fire_time" and "state" fields. Last (but not as important), add indexes to every column on the FIRED_TRIGGERS table. ```sql create index idx_qrtz_t_next_fire_time on qrtz_triggers(NEXT_FIRE_TIME); create index idx_qrtz_t_state on qrtz_triggers(TRIGGER_STATE); create index idx_qrtz_t_nf_st on qrtz_triggers(TRIGGER_STATE,NEXT_FIRE_TIME); create index idx_qrtz_ft_trig_name on qrtz_fired_triggers(TRIGGER_NAME); create index idx_qrtz_ft_trig_group on qrtz_fired_triggers(TRIGGER_GROUP); create index idx_qrtz_ft_trig_name on qrtz_fired_triggers(TRIGGER_NAME); create index idx_qrtz_ft_trig_n_g on \ qrtz_fired_triggers(TRIGGER_NAME,TRIGGER_GROUP); create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(INSTANCE_NAME); create index idx_qrtz_ft_job_name on qrtz_fired_triggers(JOB_NAME); create index idx_qrtz_ft_job_group on qrtz_fired_triggers(JOB_GROUP); create index idx_qrtz_t_next_fire_time_misfire on \ qrtz_triggers(MISFIRE_INSTR,NEXT_FIRE_TIME); create index idx_qrtz_t_nf_st_misfire on \ qrtz_triggers(MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_STATE); create index idx_qrtz_t_nf_st_misfire_grp on \ qrtz_triggers(MISFIRE_INSTR,NEXT_FIRE_TIME,TRIGGER_GROUP,TRIGGER_STATE); ``` The clustering feature works best for scaling out long-running and/or cpu-intensive jobs (distributing the work-load over multiple nodes). If you need to scale out to support thousands of short-running (e.g 1 second) jobs, consider partitioning the set of jobs by using multiple distinct schedulers (and hence multiple sets of tables (with distinct prefixes)). Using one scheduler forces the use of a cluster-wide lock, a pattern that degrades performance as you add more clients.