Closed ghost closed 5 years ago
What versions of boot and spring cloud are you using?
Can you provide a complete, minimal, verifiable sample that reproduces the problem? It should be available as a GitHub (or similar) project or attached to this issue as a zip file.
I'm using 2.0.3 Spring Boot and 2.0.2 Spring Cloud.
I'm unable to provide a sample due to confidential codes, but there's nothing much in the code. I've removed all the filters from my gateway for testing, so the gateway is just a basic Spring Boot app with @EnableZuulProxy.
My Application A uses:
HttpPost post = new HttpPost(postUrl);
StringEntity postingString = new StringEntity(mapper.writeValueAsString(param));
post.setEntity(postingString);
post.setHeader("Content-type", "application/json");
post.setHeader("Authentication", "Bearer:" + authToken);
HttpResponse response = httpClient.execute(post);
It reaches the Gateway API immediately, and the delay occurs when monitoring the gateway debug logs.
My samples with zuul don't suffer like that. I don't want any confidential code, just a minimal sample that recreates the issue. Without it, I'll be unable to help.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.
Hi,
I have a two Spring Boot application running (A & B) on one server, and the Zuul API Gateway (Spring) running on a another server (under the same network).
Application A will make a request to the gateway, and gateway will route the request to application B and return the results back. Everything is working correctly, just that zuul takes 5-6 seconds just to route the request. However, subsequent requests will be very fast (for around 15 seconds).
If it's hard to understand: Request 1: (Time = 1:00:00) Time taken: 5 seconds Request 2: (Time = 1:00:05) Time taken: 0.2 seconds Request 3: (Time = 1:00:08) Time taken: 0.2 seconds Request 4: (Time = 1:00:10) Time taken: 0.2 seconds Request 5: (Time = 1:00:15) Time taken: 5 seconds and so on...
I have enabled debug logging on my gateway, and found that this is the part where it takes 5 seconds in zuul:
2019-01-31 11:48:19 [[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Def ault (self-tuning)'] DEBUG org.apache.http.wire.wire -line no:[87]- http-outgoi ng-0 >> "{"param":"Y"}"
2019-01-31 11:48:25 [[ACTIVE] ExecuteThread: '3' for queue: 'weblogic.kernel.Def ault (self-tuning)'] DEBUG org.apache.http.wire.wire -line no:[73]- http-outgoi ng-0 << "HTTP/1.1 200 OK[\r][\n]"
So, I'm suspecting after the initial connection, zuul keeps the connection alive (for only 15 seconds), therefore I have to 'reconnect' after this time? Is there a way I can configure this? I've been playing around with many different zuul properties to no avail.
My application properties: zuul.routes.app.url=
server.servlet.contextPath=/api
ribbon.eureka.enabled=false ribbon.listOfServers=
ribbon.ServerListRefreshInterval=10000
ribbon.eager-load.enabled=true ribbon.eager-load.clients=app hystrix.command.default.execution.timeout.enabled= false ribbon.ConnectTimeout = 100000 ribbon.ReadTimeout = 100000
zuul.routes.auth.stripPrefix=false server.use-forward-headers=true management.security.enabled=true zuul.sensitive-headers= zuul.add-host-header=true
logging.level.com.netflix.loadbalancer.LoadBalancerContext=DEBUG
zuul.host.connect-timeout-millis=50000 zuul.host.socket-timeout-millis=50000