Home > Back-end >  About the spring cloud application service between two problems such as the first call is very slow
About the spring cloud application service between two problems such as the first call is very slow

Time:10-05







Everyone a great god will see, in words send directly, it indicates a illegal phrases, hair don't, tried many times all have no hair success!!!!!!

CodePudding user response:

Our program also met before, finally did not solve,

CodePudding user response:

1/f, reference rates uncle plantain response:
also met before, our project didn't solve, finally

The end how? Give up the service? Very strange is, before I have a project is using the spring of the cloud, but is deployed in a network of self-built, no problem, this time is to deploy in ali cloud, appears the question, is it ali cloud to configure something? Port is already open configuration,

CodePudding user response:

Background:
Spring cloud application, the registry using eureka, gateway to use gateway, use the configuration center, other services integrated feign and hystrix, have the following services:
Eureka, start two, each other register
Gateway, enabling a
User service, start a, integrates feign hystrix and invokes the database service
Business processing services, start a, integrates feign hystrix and invokes the database service
Database services, start a,
Cache use redis, message using spring cloud stream integration kafka (first to install the zookeeper)


The server-side configuration is not provided, the main is an integration of the spring data jpa a service, as well as the associated with a database configuration and connection of eureka configuration, there is no other configuration, not list one by one here,

Description:
I start the service in the local development environment, starting after 30 seconds can be carried out as normal and call, no problem,
In my package uploaded to ali cloud (centos7) test, found that each service starts, will be a long time to available, on track, I service launched more than about 10 minutes to available, and service calls, is also very slow for the first time,
I set the ribbon for loading and the hunger hystrix disable all didn't solve,

Question:
1, as mentioned above, why start on ali, service to wait for more than 10 minutes to available, what is wrong? At first I thought it was a ribbon at work, but I put the ribbon is set to the load and the hunger hystrix disable all didn't solve, I tried it on,
I put the other services normal boot, after reaching available, I'll start the database service (because he is a service provider, there is no integrated feign and hystrix), also takes a long time is only available,
Between 2, after services are available, for the first time service invocation (except the gateway, the gateway is normal forwarding) is very slow, such as user authentication service is very slow when call the database service, basically a long time (minutes) with the data, the occasional checked for a long time to found out the situation,

Other details:
In addition to the gateway, other services are in ali's Intranet call, I use a network IP, in fact is you can through the network IP service calls, between server memory 8 G, start the service, the remaining 2 G,

PS: the code is the hair, can sent figure (has been found in post),
Expectations have know solution and help solve, thank you very much!

CodePudding user response:

After tracking the problem is that JWT authentication here:
Claims Claims=Jwts. Parser (.) setSigningKey (pubKey). ParseClaimsJws (token). GetBody ();
I put this code split:
 JwtParser JWTS=JWTS. Parser (); 
Logger. The info (" is it here? -- -- -- 1 ");
JWTS. SetSigningKey (pubKey);
Logger. The info (" is it here? -- -- -- 2 ");
Jws CliainmsJws=JWTS. ParseClaimsJws (token);
Logger. The info (" is it here? -- -- -- 3 ");
Claims Claims=cliainmsJws. GetBody ();
Logger. The info (" is it here? -- -- -- 4 ");

Find code execution to Jws CliainmsJws=JWTS. ParseClaimsJws (token); This sentence is not carried out, didn't find any reason, after 7 minutes, code execution is normal, (must be the first call, only normal timeout after seven minutes or so)
  • Related