← Back to blog

Updated 2 October 2026

How to Size Argon2id Workers for Predictable Sign In Latency


When implementing password authentication, the hashing algorithm you choose directly affects both security and user experience. Argon2id, as recommended by OWASP, provides strong resistance against GPU based and hardware accelerated attacks, but it introduces variable computational cost that can impact sign in latency. Sizing your worker pool correctly ensures that authentication requests complete within predictable time bounds, even during traffic spikes.

Understanding Argon2id Cost Parameters

Argon2id accepts three primary cost parameters that determine its computational and memory requirements. According to RFC 9106, these parameters control the hashing algorithm's resistance to different attack vectors. The memory cost (m) specifies the amount of memory used during hashing in kilobytes. The time cost (t) controls the number of iterations performed. The parallelism degree (p) determines how many independent threads are used for computation.

The OWASP Password Storage Cheat Sheet provides minimum recommended parameter combinations for different security levels. For sensitive applications, OWASP recommends at least 64 MiB of memory, 3 iterations, and a parallelism degree of 4. These baseline values create a hashing operation that takes approximately 100 to 200ms on modern hardware, which provides a reasonable balance between security and usability.

The Parallelism Challenge for Worker Sizing

Parallelism in Argon2id creates a specific challenge for worker sizing. When you set parallelism to p, the hashing operation consumes p CPU cores during execution. If your worker process has fewer cores than p, the operation falls back to sequential execution, reducing the security margin and potentially increasing actual latency beyond expected bounds. If you have fewer workers than the number of concurrent authentication requests, requests queue behind running hashing operations.

The OWASP Denial of Service Cheat Sheet emphasizes the importance of bounding expensive application work to prevent resource exhaustion. Argon2id operations that consume significant memory and CPU time can become vectors for denial of service attacks if not properly controlled. Worker sizing must account for both the computational cost of each hashing operation and the total concurrent load your infrastructure can sustain.

Calculating Worker Pool Size

To achieve predictable sign in latency, calculate your worker pool size based on three factors: expected concurrent sign in requests, the parallelism degree of your Argon2id configuration, and the available CPU cores per worker. For example, if you expect up to 50 simultaneous sign in attempts, your Argon2id configuration uses parallelism of 4, and each worker runs on a 4 core server, you need at least ceil(50 * 4 / 4) = 50 workers to process all requests without queuing. In practice, adding 20 to 30 percent headroom accommodates traffic bursts.

However, running 50 separate Node.js worker processes may be impractical. Most deployments use worker pools with fewer processes that handle requests sequentially. In this model, each worker can handle one Argon2id operation at a time, and the parallelism degree consumes threads within that single process. With 10 workers and a parallelism of 4, you can sustain 10 concurrent hashing operations, each using 4 threads for a total of 40 threads across the pool.

Matching Parallelism to Available Cores

The parallelism parameter should not exceed the number of available CPU cores in your worker process. RFC 9106 notes that parallelism values greater than the available cores provide diminishing returns and may actually increase latency due to thread scheduling overhead. If your worker runs on a 2 core server, set parallelism to 1 or 2. If you run on an 8 core server, parallelism of 4 or 8 makes sense.

Own Auth configures Argon2id with sensible defaults that balance security and performance. The package uses a parallelism degree of 4 by default, which works well on most cloud compute instances. When deploying on resource constrained environments, you may need to reduce parallelism to 1 or 2 to prevent thread starvation.

Practical Configuration Example

Consider a deployment target of 100 concurrent sign in requests with acceptable latency of 500ms. Using OWASP recommended parameters (64 MiB memory, 3 iterations, parallelism 4), each hashing operation consumes approximately 150ms on a 4 core instance. To process 100 concurrent requests within 500ms, you need at least 30 workers running in parallel. With a load balancer distributing requests across 30 workers, each handling one operation at a time, maximum latency stays under 500ms.

If your infrastructure cannot provision 30 workers, increase the parallelism degree to utilize more cores per worker, or accept higher latency during peak traffic. Reducing memory or iterations shortens individual operation time but weakens security. Never reduce parameters below OWASP minimums unless you have specific operational constraints and accept the security trade off.

Monitoring and Adjustment

After deploying, monitor actual sign in latency distribution to validate your worker sizing. Track the 95th and 99th percentile latencies rather than averages, because hashing operations have inherent variance. If p99 latency exceeds your target, add workers or reduce concurrency limits. If latency remains well below targets during normal traffic, you may be able to reduce infrastructure costs by running fewer workers.

Own Auth exposes session and authentication events that can feed into latency monitoring. By tracking sign in completion times in your metrics pipeline, you can observe how parameter changes and infrastructure adjustments affect real user experience. This feedback loop enables continuous optimization of your worker configuration.

Security Considerations

Worker sizing affects security indirectly through latency variance. If workers become saturated during traffic spikes, authentication requests queue and take longer to complete. While this does not weaken Argon2id directly, excessively long queues may tempt operators to reduce hashing parameters to improve throughput. Resist this temptation and instead scale workers horizontally or implement request queuing with appropriate timeouts.

The OWASP Denial of Service Cheat Sheet recommends implementing per user rate limiting on authentication endpoints to prevent coordinated attacks. Combining rate limiting with appropriately sized worker pools creates defense in depth: attackers cannot easily exhaust workers because each user faces request limits, and legitimate traffic completes within predictable time bounds.

Sizing Argon2id workers for predictable sign in latency requires balancing parallelism, worker count, and infrastructure capacity. Start with OWASP recommended parameters, calculate worker requirements based on expected concurrency, and validate with real world monitoring. This approach delivers both security through strong hashing and reliability through consistent authentication performance.

Frequently Asked Questions

What parallelism value should I use for Argon2id?

Set parallelism to a value less than or equal to the number of CPU cores available in your worker process. The OWASP Password Storage Cheat Sheet recommends a parallelism degree of 4 as a reasonable default for most applications.

How do I calculate the number of workers needed for my expected traffic?

Divide your expected concurrent sign in requests by the number of hashing operations each worker can handle simultaneously. Add 20 to 30 percent headroom for traffic bursts. For example, 100 concurrent requests with one operation per worker requires at least 120 workers.

Can I reduce Argon2id parameters to improve performance?

You can reduce parameters below OWASP recommendations, but this weakens security. Only reduce parameters if you have specific operational constraints and understand the security trade offs involved.

How does worker saturation affect sign in latency?

When workers are saturated, authentication requests queue behind running hashing operations. This increases latency variance and can cause timeouts during traffic spikes. Properly sized worker pools prevent saturation and maintain predictable latency.

Does Own Auth handle Argon2id worker sizing automatically?

Own Auth configures Argon2id with secure defaults, but worker pool sizing depends on your infrastructure and traffic patterns. You must provision appropriate worker count and parallelism settings for your deployment environment.