Hi, thanks for your input.
What I'll test is to put the context.xml in the webapps/geoserver/META-INF/ so I don't have to mess with the postgresql jar place (inside geoserver WEB-INF/lib, or inside Tomcat directly). It seems also that I so keep the possibility to have Postgis stores and postgis JNDI stores at the same time, letting me pass some stores to JDNI, and assess the impact of it on the accessibility of these datasets. My aim is to have the possibility to simply copy-paste the data_dir between environments without having to change anything inside it (datastore.xml mainly in this context (no pun intended)). I have check how many connections my different DBs supported in each environement and tailored the context.xml taking that into account. This showed me also that the potential maximum number of connections all the stores could open is way above what the DB can handle, so definitely, this total max number is never reached 🙂. Anyway, I'll report here if I encounter difficulties. Thanks again, Greg ________________________________ De : Hans Yperman <[email protected]> Envoyé : lundi 9 janvier 2023 09:21 À : VANDENSCHRICK, Grégoire <[email protected]>; [email protected] <[email protected]> Objet : Re: replacing postgis stores by postgis JNDI stores, bottleneck effect? Hi, I wouldn't worry about the JNDI datasource being a bottleneck. Contention happens only when requesting or returning connections, the real action happens inside a connection object and thus uncontended. I've seen tomcats (non-geoserver) having 1000 or more connections in a pool, without sweating. In theory, you should indeed sum all individual maxActives to 1 big maxActive, but you'd be really unlucky if all connection pools are at full capacity at the same time. Hence, I'd expect you'd be using less connections in total. Be sure not to use more connections than your DB can deliver. For postgres, you can check the maximum with e.g.: SELECT * FROM pg_settings WHERE name ILIKE 'max_connections'; A downside with JNDI is that you can't change anything or clean up connections without restarting the whole geoserver instance. That's why I personally decided against it. I recently migrated a geoserver on linux and had to rename all connections. I had a migration script that contained things like this: find YOUR_GEOSERVER_DATA_DIR/workspaces -name 'datastore.xml'|while read ds; do echo "Processing $ds"; #Always validate connections xmlstarlet ed --inplace -d '//*[@key="validate connections"]' -a '//entry[last()]' -t elem -n entry -v true -a '//entry[last()]' -t attr -n key -v 'validate connections' $ds; sed -ri -e 's/>olddbname.domain.be</>newdbname.domain.be</' -e 's/>olddbname2.domain.be</>newdbname2.domain.be</' -e 's/>olddbname3.domain.be</>newdbname3.domain.be</' $ds done; Of course, this needs severe adaptation for your situation, only run when your geoserver is not running, and make sure xmlstarlet is installed Hans Yperman Department IT [cid:bec99dce-4562-4a3c-ade3-0a8114954651] Vlaams Instituut voor de Zee vzw InnovOcean Campus, Jacobsenstraat 1 8400 Oostende, België ☎+32 (0) 59 33 61 13 📧 [email protected]<mailto:[email protected]> www.vliz.be<http://www.vliz.be> ________________________________ Van: VANDENSCHRICK, Grégoire <[email protected]> Verzonden: woensdag 4 januari 2023 13:12 Aan: [email protected] <[email protected]> Onderwerp: [Geoserver-users] replacing postgis stores by postgis JNDI stores, bottleneck effect? Hi, We have 50 postgis stores in our geoserver, all set with the default parameters. Now, to avoid having to change IP address of postgresql databases in all the datastore.xml files (currently done with python, when deploying the data directory from dev to staging or production (different environments, different databases), we think to adopt a different strategy: To define once and for all a postgresql resource (named jdbc/databrugis) in a context.xml file, and pass all the 50 stores from postgis type to postgis (JNDI) type using that resource (java:comp/env/jdbc/databrugis). My question is this: Does this will provoke a bottleneck? Having 50 stores using the same resource? Should I change some resource parameters, for instance maxActive, from 20 to let's say maybe not 20*50 but a bigger number? And will this be without effect on the DB slots usage, to have it connected from one resource only instead of 50 different stores? Thank you already for your expert insight on this 🙂. Greg
_______________________________________________ Geoserver-users mailing list Please make sure you read the following two resources before posting to this list: - Earning your support instead of buying it, but Ian Turton: http://www.ianturton.com/talks/foss4g.html#/ - The GeoServer user list posting guidelines: http://geoserver.org/comm/userlist-guidelines.html If you want to request a feature or an improvement, also see this: https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer [email protected] https://lists.sourceforge.net/lists/listinfo/geoserver-users
