Authors :
Xinyi Lu
Volume/Issue :
Volume 10 - 2025, Issue 11 - November
Google Scholar :
https://tinyurl.com/33cu3jhs
Scribd :
https://tinyurl.com/5xx6w9ry
DOI :
https://doi.org/10.38124/ijisrt/25nov415
Note : A published paper may take 4-5 working days from the publication date to appear in PlumX Metrics, Semantic Scholar, and ResearchGate.
Note : Google Scholar may take 30 to 40 days to display the article.
Abstract :
In many school projects or small applications, it is common to run operations such as sending a report or
cleaning old data regularly. If you have only one server, you can handle this efficiently with a cron job. However, if you
have multiple servers, operating the same job simultaneously would be time-consuming. This paper illustrates a simple
solution: let all servers “race” to insert one row into a normal database table. The database’s unique constraint makes
sure only one succeeds. The successful server performs the operation. After it finishes, it removes the row so the process
can be performed repeatedly. We do not need special tools or external help; just one small table and a simple trick.
Keywords :
Decentralized Scheduling; Unique Constraint Lock; Lightweight Coordination; Distributed Job Execution; Fault Tolerance; PostgreSQL.
References :
- UNIQUE Constraint https://www.postgresql.org/ docs/current/ddl-constraints.html#DDL-CONSTRAINTS-UNIQUE-INDEX
- INSERT … ON CONFLICT https://www.postgresql.org/docs/current/sql-insert.html#SQL-ON-CONFLICT
- MVCC Intro https://www.postgresql.org/ docs/current/mvcc-intro.html
- Single-Machine Scheduling
- Cron man page https://man7.org/linux/man-pages/man8/cron.8.html
- Systemd Timers https://www.freedesktop.org/ software/systemd/man/systemd.timer.html
- Larger Systems (for Comparison)
- Celery https://docs.celeryq.dev/en/stable/getting-started/introduction.html
- Airflow https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/overview.html
- Sidekiq https://sidekiq.org/
In many school projects or small applications, it is common to run operations such as sending a report or
cleaning old data regularly. If you have only one server, you can handle this efficiently with a cron job. However, if you
have multiple servers, operating the same job simultaneously would be time-consuming. This paper illustrates a simple
solution: let all servers “race” to insert one row into a normal database table. The database’s unique constraint makes
sure only one succeeds. The successful server performs the operation. After it finishes, it removes the row so the process
can be performed repeatedly. We do not need special tools or external help; just one small table and a simple trick.
Keywords :
Decentralized Scheduling; Unique Constraint Lock; Lightweight Coordination; Distributed Job Execution; Fault Tolerance; PostgreSQL.