It seems like a bad configuration of two servers as they are not sharing the session data. normally, the servers share the session related information such as cookies so that client can get the response from either of the servers.
I am not sure whether you can really control which server to hit (though it hit the second server during recording, because load balancer has chosen that server for you at that point in time), it is completely Load balancer decision (based on the algorithms used, like least response times, client IP-based etc)
I suggest to check the server configurations whether they are sharing cookie level data or not. Also, suggest check which algorithm is being used by the load balancer to distribute the load across two servers.
If they are not causing the issues, then look at how the cookies are sent by the server and how the(JMeter) client is resending them (by HTTP Cookie Manager) i.e., check whether Cookies are sent by the JMeter as expected by the server(s). sometimes it is possible that partial cookies are being sent.
Please answer the following questions:
- Is the request always sent to Server2 when one thread is used?
- Whether the request is getting succeeded when the requests hit the server1 for single thread?
- Are you hitting the load balancer URL (which inturn decides the server to hit)? Or hardcoded one of the server address?