Even though the spring application is shut down in the spring eureka server, it routes to the terminated application. how do i solve it? - spring

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.

Related

Cloud run cold start spring boot issue

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.

Spring Boot health seems to return health check UP while context not refreshed

While starting a webbapp, we have a S3InboundFileSynchronizer that loads files during a little time.
We would need to don't let the web server available until all files are loaded. However, the /health endpoint seems available and accessed by our cloud manager to admit it can switch between the previous instance and the one that is starting.
How is it possible to block /health actuator access while the files are loading ?
I tried with #EventListener(classes = { ContextRefreshedEvent.class }) but it doesn't seem to have effect on this... :/
Please help

Spring boot restful webservices

My spring boot restful web services is working even though stopped running microsoft sqlserver database in my services. How does it work?
There might be below reason.
You might be using some kind of cache so still response is coming form cache even your db is down.
You might be checking services which are not required db transaction..
OR if you are only referring you application is continue to running then might be spring.datasource.continue-on-error=true has been set. or you might have some defined data source validations properties to at-least continue run app and whenever db is back, it will established a connection.

Spring boot service higher response times under heavy load

the response time of my spring boot rest service running on embedded tomcat sometimes goes really high. I have isolated the external dependencies and all of that is pretty quick.
I am at a point that I think that it is something to do with tomcat's default 200 thread pool size that it reserves only for incoming requests for the service.
What I believe is that all 200 threads under heavy load (100 requests per second) are held up and other requests are queued and lead to higher response time.
I was wondering if there is a definitive way to find out if the incoming requests are really getting queued? I have done an extensive research on tomcat documentation, spring boot embedded container documentation. Unfortunately I don't see anything relevant.
Does anyone have any ideas on how to check this

How to delay Eureka client registration with Eureka Server?

I have a Spring Boot application which is also a Eureka client. The normal behavior of the application is to register with Eureka server on start up as UP. I have a requirement that the application shouldn't register with the Eureka server until smoke testing is completed during deployment.
Is there a way to delay the registration with Eureka Server or register as OUT_OF_SERVICE with some type of configuration changes? I am aware of the Eureka REST endpoints to register, unregister, and change status.
Setting eureka.instance.initial-status=OUT_OF_SERVICE will register the service with that status.
I had a similar case where I needed my service to perform some preprocessing before indicating that it was available. I did this by implementing a custom HealthIndicator that starts with a state of OUT_OF_SERVICE and transitions to UP once all of the preprocessing completed. This always seemed a hack to me but it works. Hopefully, Spencer can provide better guidance since he is an author in the Spring ecosystem.
Are you looking for;
eureka.client.initialInstanceInfoReplicationIntervalSeconds=<some N seconds>
This property specifies the initial delay before the clients send health status i.e. UP etc.

Resources