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.
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?