We have requirement to store a long string (end-user specific) in a cookie but because of the size limitation of the cookie, we are not able to store it. We are required to send this String with every call to the database. We are using MarkLogic database here. Please suggest what will be drawback of using HTTP Session to store that?
Also, is there any other way to store it? We have multiple AEM instances in production.
Thank you.
Solved! Go to Solution.
Views
Replies
Total Likes
I would question the application design when you constantly need to send more than 4k from the client to the server. Does this payload change with every request?
If not, the first natural approach is a server-side session, but this design does not scale at all, and is often problematic in terms of failover, its more and more discouraged. AEM does not encourage to use server-side sessions, because that as a really bad impact on your application performance, when you need to render a lot requests and cannot cache them. Naturally your publish instances will become a bottleneck.
Why don't you store that data once in the database and the browser just sends an ID in a cookie, so the application can reference it?
Hi @priyankak11,
What is the size of the cookie? Which places did you try saving them? Did you try both java and java-script?
Thanks,
Kiran Vedantam.
Views
Replies
Total Likes
If cookie has some limitation in your case then why did you not go with the sessionStorage and localStorage for the same purpose if you go with javascript way. In java you can easily take help from HTTP session api itself for the same.
Hope this will help.
Umesh Thakur
I am not Using session because session will slow down the performace and using HTTP Session is not recommended by Adobe.
I would question the application design when you constantly need to send more than 4k from the client to the server. Does this payload change with every request?
If not, the first natural approach is a server-side session, but this design does not scale at all, and is often problematic in terms of failover, its more and more discouraged. AEM does not encourage to use server-side sessions, because that as a really bad impact on your application performance, when you need to render a lot requests and cannot cache them. Naturally your publish instances will become a bottleneck.
Why don't you store that data once in the database and the browser just sends an ID in a cookie, so the application can reference it?