Why there is stickiness in the browser. Why the request from the same browser goes to the same pid ?

The "stickiness" you're observing in your browser — where requests from the same browser keep going to the same process ID (PID) or server instance — is typically due to session stickiness, also known as sticky sessions or session affinity.

Let’s break it down:


Why it happens:

1. Load Balancer Behavior (Sticky Sessions)

If you're running multiple backend server instances behind a load balancer, some load balancers are configured to route the same client (browser) to the same backend server for the duration of the session. This is to maintain session consistency.

So if a user hits your service, the load balancer remembers which backend PID served it and routes subsequent requests to that same one.

2. Browser Reuse of HTTP Connections (Keep-Alive)

Browsers reuse persistent HTTP connections (enabled by default via Connection: keep-alive) for requests to the same origin. This means:

This makes it seem like all requests go to the same PID, but it's a browser + networking optimization.

3. Caching and Localhost Development

If you're testing locally:

4. WebSockets or Sessions