Issue
I am having a lot of issues regarding my Spring Boot application that is starting as normal, but when I access a page that is secured by Spring security, it takes a lot of time to load the page.
If I click on the /userpage icon, then the login screen should appear if not logged in. Well, in this case the display of login screen takes up to 5 minutes. Same thing for the /process_login (the link created to produce the login).
Things that I did from the internet:
I did placed
logging.level.org.springframework.boot.autoconfigure=DEBUG
in the application.properties, nothing relevant in the logsI start the application on a 1CPU, 1GB RAM virtual machine on OceanDigital. There were no issues of this type on my Idea editor on my PC. The db is a MongoCluster from MongoAtlas.
I think it is related to the application start-up options. I start the application like this:
./mvnw spring-boot:run &
orman spring-boot:run &
(I add & to make it work in the background.)ByCrpyt len is 4.
After the login is performed, then any other request, including a new login is done with easy, in a matter of ms.
Any suggestions?
UPDATE
When I connect with the Idea Editor to the remote server and run on it, this issue does not appear. So I still think it is a matter of start-up command or configuration.
UPDATE 2
I got this Warn: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [607,720] milliseconds.
Solution
This sounds a lot like an issue with your random number generator and the required levels or entropy to create the random number, have a look at this answer How to deal with a slow SecureRandom generator?.
You will see advice that will help to decide how you want your secure randoms to be generated. What you decide to use will depend completely on your requirements, but be aware of the potential slowness of using /dev/random.
Answered By - Paul Whelan
Answer Checked By - Gilberto Lyons (JavaFixing Admin)