For the application server set as clustering in glass fish. I have sent request through jmeter and all the requests hits to only one server . Expected was requests should be distributed to multiple servers in the cluster. But if sent requests manually clustering is working. Please help to sort out this issue
-
Do you have Cache Manager in JMeter? – Ori Marko Jan 29 '18 at 05:34
-
yes cache manager is added, but not checked 'use cache control' – anu shaji Jan 29 '18 at 05:39
-
If you remove Cache Manager in JMeter, is it load balancing working? – Ori Marko Jan 29 '18 at 05:46
-
no.Its not working while removing the cache manager – anu shaji Jan 29 '18 at 06:33
-
Are you sending your requests through a proxy, or directly to the GlassFish servers? If there was a problem here, it will be with your proxy (Apache, Nginx etc) not GlassFish. – Mike Jan 29 '18 at 13:38
1 Answers
There could be different clustering load balancing mechanisms, as far as I can see from the GlassFish Server High Availability Administration Guide:
Cookie Method
The Loadbalancer Plug-In uses a separate cookie to record the route information. The HTTP client (typically, the web browser) must support cookies to use the cookie based method. If the HTTP client is unable to accept cookies, the plug-in uses the following method.
Explicit URL Rewriting
The sticky information is appended to the URL. This method works even if the HTTP client does not support cookies. To implement explicit URL rewriting, the application developer must use HttpResponse.encodeURL() and encodeRedirectURL() calls to ensure that any URLs in the application have the session information appended to them.
So depending on your Load Balancer configuration you need to
- Either define either different cookies in the HTTP Cookie Manager
- Or make sure different threads send requests to different URLs i.e. via HTTP URL Re-writing Modifier
- In any case it is recommended to add DNS Cache Manager so each virtual user would resolve the underlying IP address of the application under test on its own.