-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Lance,
On 6/21/17 11:09 AM, Campbell, Lance wrote: > Tomcat 8, 8.5, or 9 Is there a session manager for Tomcat that does > not keep sessions in memory at all but stores the session > attributes in a database? http://tomcat.apache.org/tomcat-8.0-doc/cluster-howto.html#Overview http://tomcat.apache.org/tomcat-8.0-doc/config/manager.html (search for "database") > Example: If I create a session for the first time then the > session manager would create a session ID and write it to a > database table. Now if you do setAttribute on the session it would > then insert a row in the database based on the session ID and name > of the attribute. It would not delay. It would write it at that > moment. If you do a getAttribute it would then select the value > from the database based on the session ID and name. At no time is > a session object kept in memory by the session manager.> I looked > over the Tomcat JDBCStore. But it looks like it still maintains > sessions in memory for a time before writing them. I would like an > implementation that never keeps them in memory. Direct writing and > direct reading when a session does a setAttribute or getAttribute. I believe the JDBCStore doesn't prevent data from existing in memory. > The other element is that if I have N number of tomcat instances > that run behind a load balancer any one of them can receive an > incoming request. There is no communication that has to occur > between tomcat instances. Using JDBCStore basically requires the use of Clustering, which does in fact notify the other nodes in the cluster about new sessions being created, etc. It can't work any other way, because a node needs to know if a session exists or not. If there is no data in the session, what is in the db? If it's only session attributes, then there is no difference between an empty session and an invalid session. Clustering also generally batches the updates to the other cluster members when the request is completed, so I expect JDBCStore does the same thing. > Is this even possible to do? My feeling is that the Manager might > have some fields that never do anything. I don't want to create > something that someone else has already done. I don't believe there is a way to do what you are requesting with an out-of-the-box Tomcat. > If this is able to be done and it has not been developed before I > would be happy to do it if someone wants to give me some basic > starting information on how to do this. I would be happy to share > it with the community. What would be great. I think you might want to look at the memcached implementation(s) of a Tomcat Manager floating around on the Internet... those will probably give you a good starting point. If you want to share the code back to the Tomcat project, please take care to obtain the proper permission and ensure that the original license of anything you "borrow" is compatible with AL2. I would be +1 on incorporating such a Manager into Tomcat, as long as it was configurable enough to be useful to others (e.g. batch updates at request-completion as opposed to immediate-write, customizable serialization mechanism e.g. XML/JSON/Java Serialization). - -chris -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAllKyb0ACgkQHPApP6U8 pFgQqw//WQpA2buIBWpJ10uLpNVs/Ic43Ll2d0+skWpqATrhJOavgIMs0ytTgV2u IeQuGf1G9a298HicNEBlEVF7pLbzqF1MX4ixMFbFfjY0Q/kCc2sZT/XuqV3FbDaK Nt1WRQ42pvgPNMOkabbwubq4jCkWaQIjRdbrBXkveYJObuCxN7gs4iLZff43rAjX GwznapnpR1eKZzMTS4fiAoKQjQU9Gx9tRDVrOcRG4/62WBFrTh84D+HkVpISbIq+ Y/7rMndzkL6iMf+s0VB/J9MAE72EiT61xKD1QhG7dDvSBsiRAfNJqQbDhFBOICOG /6BmkxMB5TXeAEvHmmaJeoDZwOScDAjv9KUrSAGSA0sMghfddIGlQgmbWLKkgXL6 v54Yh9oXZaraSuQyPBreDWwBWSW7Rbptnt53tryv3McjXrDq1DuGWFJejuHz7X57 J+LULa3JK6OaOoKr0tzx6U+IBc5GIQ/0ANzqJA7yCRHWjFFPf6yeSF4k+IRfGh67 CEYjC7u7jxRW9wsRrafHKgkFEVpVWsDr4JoqKlofYDeThdi6oz8+55uMoiirF21O R1XKQs7EyNmU8xPYEH6+yw8oBsPAG6BJjmoMz1ybvxg82VCk/493jWyICgD19M6q ldsmKuRcT4dO0E6HWeUerKHOp/gDT6s1GKlcYTUDw84vsy2oUys= =vFLG -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org