I have an ecommerce website wherein as soon as a new user comes on website then a new visitorId
gets generated for that user in database and that visitorId
cookie gets stored in his browser and in memory session of server. In his subsequent journey over the website we use this visitorId
to map and store any information associated with this user like products added by him in cart, products he has browsed etc. Having this visitorId
thus becomes important.
Now I am working on improving initial website load time for user and in this process I find this database query which inserts record for a new user consumes some time. And by using different strategy I can either cut down or reduce this time consumed. Although it's not a lot of time, but still it's a overhead.
Please suggest some strategy that could be used to handle this functionality in a better fashion.
Current Setup
- Java App based on Spring & Hibernate
- MySQL server
- Hosted on AWS using RDS, ELB, EC2