← All articles
◈ Tech & ServiceNowServiceNowArchitecture

Understanding Semaphore in ServiceNow

Posted on 20 Aug 2021 · 1 min read

Like many ServiceNow professionals, Semaphore often comes to mind only when there is a performance issue. However, Semaphore is much bigger than that.

What is Semaphore?

According to ServiceNow and JVM documentation, a Semaphore manages and protects ServiceNow resources and limits the number of activities for a specific resource. It does this by controlling transaction queues in a first-in-first-out (FIFO) fashion.

How It Works — An Example

Imagine that ServiceNow allows 2 threads and 10 semaphore slots for a given resource. What does this actually mean?

It means ServiceNow will allow 2 transactions to run simultaneously. So what happens when 6 transactions arrive at the same time?

  • ServiceNow will run 2 transactions immediately.
  • The Semaphore will place the remaining 4 in the queue, processing them FIFO.

Slow performance can result from transactions waiting in queue to be processed — but this is necessary to protect your resources and ensure the system is not overloaded.

What if 15 Transactions Arrive at Once?

In this case:

  • ServiceNow runs 2 transactions immediately.
  • The Semaphore queues 10 transactions.
  • The remaining 3 transactions are rejected.

The Takeaway

The Semaphore is your platform's gatekeeper. It controls and organises the transaction queue to protect resources from being overwhelmed. Understanding this helps you reason about performance not just reactively, but proactively — designing solutions that respect platform limits.