I am using camel to orchestrate web service calls to multiple rest endpoint. I am using multicast to send the request params and creating headers for each webservice in different routes and using recepientList to call dynamic url. But looks like the whole process is taking too long.
There is minimal processing of service responses so that doesnt take more than 100ms.
Here is the first multicast route:
from("direct:getCustomer")
.multicast().shareUnitOfWork().parallelProcessing().streaming()
.aggregationStrategy(txnAggregator)
.executorService(exeServiceForRest)
.to("direct:RouteA", "direct:RouteB", "direct:RouteC");
There are 8 routes where this msg will be multicasted.
2 of those routes are making another multicast call to another web service based on the response.
from("direct:routeA")
.process(orderReqBuilder)
.streamCaching()
.recipientList(header("url"))
.multicast().shareUnitOfWork().parallelProcessing().streaming()
.executorService(exeServiceForRest)
.aggregationStrategy(txnAggregator)
.to("direct:subRouteA", "direct:subRouteB");
The max response time of all 8 routes is 400ms. And the max response time of these subRoute web services is 300 ms
So the overall response time should be 400(level 1 service calls) + 300(level2 servicer calls) + some computation time(~100 ms) = 900 ms
but it is taking around 2 sec to complete.
Moreover, in the logs I found :
WMPLTFMLOG420420 1501782127187 2017-08-03 10:42:07.187 when the msg comes to header builder class
WMPLTFMLOG420420 1501782127362 2017-08-03 10:42:07.362 applog.cls=org.apache.camel.component.http4.HttpComponent,applog.mthd=createConnectionManager,applog.line=322,applog.msg=Created ClientConnectionManager org.apache.http.impl.conn.PoolingHttpClientConnectionManager#77809ca2
So there is almost 200ms spent in creating the url and sending the request, I guess. Why is it happening?
Overall, how can I improve the performance in this case. I test this on 4 core machine.
Camel version 2.18.3 and I am using http4 component.
Related
I am using Axios instance in a React app to fetch data from GET requests. Backend server is deployed on Heroku(Professional Dyno) and written in Django REST framework. Database is deployed on AWS.
On postman, APIs are giving response in around 2-3 seconds:
Postman Screenshot
But in the react app, response time is around 25-30 seconds.
React app response time Screenshot
Please note that I am calling around 10 different APIs in a single page. Is this affecting the response times?
The problem is, your request got blocked for 18 seconds. When you are executing multiple heavy requests, it's definitely possible that this requests takes some time to be even executed. If you want to check whether this is the reason for it, you could just comment out the other requests an examine what happens.
An interesting request on what blocked means can be found here.
I have a very simple Azure Logic App that makes a REST call to an SAP web server and translates the response JSON before sending a response back to the caller of the Logic App. What is baffling me is that when the SAP call takes just over 1 minute, the Response action throws this error:
ActionResponseTimedOut. The execution of template action 'Response' is
failed: the client application timed out waiting for a response from
service. This means that workflow took longer to respond than the
alloted timeout value. The connection maintained between the client
application and service will be closed and client application will get
an HTTP status code 504 Gateway Timeout.
According to Microsoft documentation, the time-out HTTP calls is supposed to be 120 seconds (2 minutes). Unless the Logic App history display is completely wrong, the entire Logic App never takes any where near 120 seconds to complete, it keeps failing at just over 60 seconds.
The SAP GET CustomerCredit action shown in the sample below is a Logic Apps Customer Connector, not the built-in SAP action. The Logic App is the current production version, not a preview version.
Am I doing something wrong? I'd be fine if the Logic App actually timed-out after 2 minutes, but a 1 minute time-out is a bit extreme.
I don't know why your logic app shows ActionResponseTimedOut error even if it doesn't execute more than 120 seconds. I test it in my side and it works fine it the execution time less than 120 seconds. Here I can provide a workaround which may help with your problem.
1. Click "..." --> "Setting" of your "Response" action.
2. Enable "Asynchronous Response"
3. Then when you request the url of logic app, it will response with 202 accepted immediately. And in header of the response, we can find a "Location".
4. Request the url in "Location", it will response you with the result of the logic app(if the workflow is completed). If the workflow hasn't been completed, it will still response 202.
I'm trying to make a request-reply return a response over three microservices. So,
1. api
2. backend service
3. another backend service
However, the message is not making it back to the api (which is blocking) and I get a timeout issue. I've troubleshooted the service to service communication and this leaves me with camel as the cause.
I have read camel in action and various other sources, but am unsure what the best way to implement a synchronous transaction over 3 or more micro services. The EIP patterns usually only accommodate 2 services communicating.
Here is an overview of the camel routes for each service.
API
rest("/api")
.post("/apply").route()
.inout(APPLY_QUEUE)
Backend Service 1
from(APPLY_QUEUE)
.bean(somebean, "checkApplication")
.to(REGISTER_QUEUE)
Backend Service 2
from(REGISTER_QUEUE)
.bean(somebean, "createApplication")
I'm using the Camel's ProducerTemplate to make http calls like below.
#Produce
private ProducerTemplate producer;
producer.requestBodyAndHeaders(url, requestString, headers,
String.class);
In my application, I'm using this to call another time taking rest api multiple times for a batch job. But from the access logs of the other server, I found that the server is getting only 2 requests at a time.
Once, it processes these two, it was getting another 2 requests.
Looks like something to do with the connection pooling of Camel's producerTemplate. Is it defaulting to 2 connections?
How can I change this configuration?
I'd like to start multiple HTTP requests rapidly after each other, without having to wait on the previous response to arrive. I've tried this using WebClient.UploadStringAsync, but this doesn't work. I'd like to efficiently implement the following scenario:
Send request 1
Send request 2
Send request 3
And in another thread:
Receive response 1
Receive response 2
Receive response 3
Can this be done in Silverlight?
I'd like to start multiple HTTP requests rapidly after each other, without having to wait on the previous response to arrive
That's called HTTP Pipelining (assuming you hope to use the same socket) and it's not supported by many proxies and gateway devices. I would be surprised if Silverlight tried to support it.
Yes it can be done. What leads you to believe that UploadStringAsync isn't working?
Here is my guess you are posting to ASP.NET with Sessions turned on (the default) right?
The requests will be queued at the server end because ASP.NET will only process one request for a specific Session at a time.