Is it possible to stop/interrupt an rpc request to a servlet before it returns with a response(in gwt)? Is it possible to get hold of the request's thread so one can stop it or something like that?
Thanks in advance.
Related
Warning: Please bear with me and I am fairly new with Gatling. So, apologies in advance. :P :)
I was going through the Loadrunner Asynchronous Calls Function - wb_reg_async_attributes, and I found that there are four different Asynchronous Conversation Patterns, which are:
Poll - The client polls the server periodically for information.
Long Poll - The client polls the server and waits for a response.
When the response arrives, another poll request is initiated.
Push -The client sends a request. The server response is to send updates
when there are changes to the requested information.
Cross-user - One user performs an activity that is reflected in another user's client. For example, user1 sends an email and user2 receives
notification.
Now, I have a requirement where I need to test Long-Polling using Gatling.
As far as I know, there are two ways in Gatling:
Poll
SSE
Please feel free to let me know in case I am wrong.
By using Polling function of Gatling, I am getting a Gateway Timeout Error. My theory is:
Gatling sends the request --> doesn't get a response --> Comes back with Gateway Timeout error.
Is there a way I can emulate Long Polling in Gatling? Please help me out in resolving this challenge.
Poll works in the similar fashion as LongPoll
To respond a http request, we can just use return "content" in the method function.
But for some mission-critical use cases, I would like to make sure the http
200 OK response was delivered. Any idea?
The HTTP protocol doesn't work that way. If you need an acknowledgement then you need the client to send the acknowledgement to you.
Or you should look at implementing a bi-direction socket (a sample library is socket.io) where the client can send the ACK. If it is mission critical, then don't let it be on just http, use websockets
Also you can use AJAX callbacks to gather acknowledgment. One way of creating such a solution would be UUID generated for every request and returned as a part of header
$ curl -v http://domain/url
....
response:
X-ACK-Token: 89080-3e432423-234234-23-42323
and then client make a call again
$ curl http://domain/ack/89080-3e432423-234234-23-42323
So the server would know that the given response has been acknowledge by the client. But you cannot enforce automatic ACK, it is still on the client to send it, if they don't, you have no way of knowing
PS: The UUID is not an actual UUID here, just for example shared as random number
Take a look at Microsofts asynchronous server socket.
An asynchronous server socket requires a method to begin accepting connection requests from the network, a callback method to handle the connection requests and begin receiving data from the network, and a callback method to end receiving the data (this is where your client could respond with the success or failure of the HTTP request that was made).
Example
It is not possible with HTTP, if for some reason you can't use Sockets because your implementation requires HTTP (like an API) you must acknowledge a timeout strategy with your client.
It depends on how much cases you want to handle, but for example you can state something like this:
Client generate internal identifier and send HTTP request including that "ClientID" (like a timestamp or a random number) either in the Headers or as a Body parameter.
Server responds 200 OK (or error, does not matter)
Client waits for server answer 60 seconds (you define your maximum timeout).
If it receives the response, handle it and finish.
If it does NOT receive the answer, try again after the timeout including the same "ClientID" generated in the step 1.
Server detects that the "ClientID" was already received.
Either return 409 Conflict informing that it "Already exists" and the client should know how to handle it.
Or just return 200 OK and the client never knew that it was received the first time.
Again, this depends a lot on your business / technical requirements. Because you could even get two or more consecutive loops of timeout handle.
Hope you get an idea.
as #tarun-lalwani already written is the http protocol not designed for that. What you can do is to let the app create a file and your program checks after the 200 respone the existence and the time of the remote file. This have the implication that every 200 response requires another request for the check file
For example, I've got 2 threads, each sending a request to the same serial. Will the response of them follow the same order of the request? Or chances are the response of the latter request might come first?
The serial reading process has no way to know the response it's receiving is for which request. So I want to make sure the response order to handle the reading process.
Thanks.
I have a nodeJS server running. There are some requests that the server will receive that don't need a response (just updating in the server). If the update fails, it isn't something that the client will need to worry about. In order to save bandwidth, I'd like to not respond to said requests. Can not responding to requests somehow affect my server's performance?
Assuming you are using http, You have to at least return an http response code. If you don't you are violating http -- the client is going to wait for a response, and will die trying (i.e. will timeout after a while).
According to the documentation for end, you must call end for every response. That is going to send a response code for you, if you don't specify one. So yes, need to respond.
How do i make sure that i can make an RPC call only after i finish the first RPC call?Also how do i make sure that i can refresh my view only after i finish an RPC call.
I know i can do it in the OnSuccess method,but apart from that is there something which i can work with?
I have made significant research on this and also saw that i can use a Timer,but i feel its a heavyweight on client side.
Can i use Scheduler.scheduleDeferred to defer my second rpc call ??
Thanks
Basically you would have 2 RPC callbacks.
First RPC callback onSuccess would issue the second RPC call.
Second RPC callback onSuccess is a place where you should 'refresh' your page.
Using timers is definitely not a good practice for this task.