A Simple Way to Run One Copy of a Job on Many Servers


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 :

  • PostgreSQL Basics
  1. UNIQUE Constraint https://www.postgresql.org/ docs/current/ddl-constraints.html#DDL-CONSTRAINTS-UNIQUE-INDEX
  2. INSERT … ON CONFLICT https://www.postgresql.org/docs/current/sql-insert.html#SQL-ON-CONFLICT
  3. MVCC Intro https://www.postgresql.org/ docs/current/mvcc-intro.html
  • Single-Machine Scheduling
  1. Cron man page https://man7.org/linux/man-pages/man8/cron.8.html
  2. Systemd Timers https://www.freedesktop.org/ software/systemd/man/systemd.timer.html
  • Larger Systems (for Comparison)
  1. Celery https://docs.celeryq.dev/en/stable/getting-started/introduction.html
  2. Airflow https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/overview.html
  3. 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.

CALL FOR PAPERS


Paper Submission Last Date
30 - November - 2025

Video Explanation for Published paper

Never miss an update from Papermashup

Get notified about the latest tutorials and downloads.

Subscribe by Email

Get alerts directly into your inbox after each post and stay updated.
Subscribe
OR

Subscribe by RSS

Add our RSS to your feedreader to get regular updates from us.
Subscribe