I am using a microservices architecture for writing the application using spring boot and it is working fine . But after some time of inactivity when I try to hit the URL it gives connection timeout error on browser . But as soon as I restart the entry point of application (i.e., the API-Gateway) it starts working and there is no error in API-Gateway . Also I haven't set any property related to timeout .
Have anybody faced any this issue or any guess what might be causing the problem ?
Related
When I checked the Eureka Dashboard, I confirmed that the application was terminated normally and was not displayed, but after that, it was routed to the terminated Spring application for about 30 seconds and gave a 500 error.
I think it's probably cached in eureka. I'd rather not be routed even for one second rather than a way to reduce the period.
Please let me know if there is any material or method that can help me thank you.
I don't want to be routed any more to Spring applications that are terminated in Spring eureka.
I have login API developed in spring boot and deployed on cloud run with min instance 1. But for some request it is taking 20s to process which is not desirable. When I checked logs, I found that application is starting again and it is taking time and most of request are processed within 100ms .Please suggest where Im going wrong.
I found that it was a cold start problem so kept min instance to 1. But still for some request it is taking more time than expected.
If an error occurs during startup, e.g. wrong database password, the server will not start. But if you use spring actuator, the server could return DOWN on the health interface, instead of not starting the server.
Is it possible to start the server despite errors and then display the error via /health?
I have below architecture in my project
My UI Service(Port 8080) making Feign call to Gateway Service(Port 8085).
My Get call from UI service is " http://localhost:8080/invoice-list?startDate=2018-08-05&endDate=2018-10-05 "
Similar call from Gateway Service "http://localhost:8085/invoice-download-service/invoice-list?startDate=2018-08-05&endDate=2018-10-05"
When i make this GET call from UI service i get below error within minute
is feign.RetryableException: Read timed out executing GET http://localhost:8085/invoice-download-service/invoice-list?startDate=2018-08-05&endDate=2018-10-05] with root cause
java.net.SocketTimeoutException: Read timed out
But when i make direct call from Gateway Server to microservice, i dont get error.
Application.properties file of Gateway service
hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=160000000
ribbon.OkToRetryOnAllOperations=true
ribbon.ReadTimeout=5000000
ribbon.ConnectTimeout=5000000
ribbon.MaxAutoRetries=3
ribbon.MaxAutoRetriesNextServer=3
zuul.host.socket-timeout-millis= 5000000
zuul.host.connect-timeout-millis= 5000000
Here i have set readtimeout and connecttimeout property around 8 to 10 min, hence i am not getting error.
Application.properties file of UI service
spring.application.name=external-ui-service
server.port=8080
Here in UI service i dont have timeout property. I tried above properties here but not working.
Obviously this UI service is not using ribbon,zuul etc. This is just an making Feign call to gateway.
So what should i do to increase timeout in UI service?
Added below properties in UI Service's application.propeties file.
feign.client.config.default.connectTimeout: 160000000
feign.client.config.default.readTimeout: 160000000
This issue might also be caused by default laodbalancer implementation of Spring Cloud Gateway in case you make use of Eureka Server and run your microservices undockerized on windows. Services are running on localhost, but Eureka says to the loadbalancer of the gateway to route the request to host.docker.internal.
The links down below give a couple of solutions:
https://localcoder.org/spring-boot-cloud-eurka-windows-10-eurkea-returns-host-docker-internal-for-clien
https://dimitr.im/fix-eureka-localhost
We have this behavior of MongoDB connection which is unable to be traced; the MongoDB connections after some application idle time starts getting MongoDB connection error for every request made by the application. Only after the restart of the AppServer ('Tomcat', the application is deployed on) the MongoDB connections are reacquired and works well.
Want to know if anyone have come across such an issue and probable configuration solution. One another way which I think is then to Exception handle and do a retry for getting the connection.
NOTE: Java 1.7, Spring 3.1.x have been used for Server code. MongoDB Version: 2.6.9. Mongo Driver: mongo-2.10.1
Use these options for performance and preventing this problem.
autoConnectRetry = true
connectTimeout = 3000
connectionsPerHost = 40
socketTimeout = 120000
threadsAllowedToBlockForConnectionMultiplier = 5
maxAutoConnectRetryTime=5
maxWaitTime=120000