Use Postgres connection pooling for Nominatim. Resolve "too many clients already" error. #3477
-
I did a fresh install of Nominatim 4.4 along with Postgis 15-3.4. Most of the things work fine as expected however one of my scripts broke. That script basically was doing around 500 reverse geocoding requests on With the updated installation, around 100 (probably due to the default value of max_connections = 100 in postgresql.conf) out of 500 requests are successful and for the rest, nominatim returnes
Did something change in newer version in regards to how connection with Postgres is initialized? Can i configure nominatim to initiate the connection pool with Postgres and reuse connections? Would appreciate if someone has any pointers on how to approach this. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I ran into the same issue in earlier Nominatim versions, too. Just set the max_connections higher. Both 500 and 1000 works. |
Beta Was this translation helpful? Give feedback.
Nominatim starting version 4.3 has two options for the frontend: PHP and Python. You can see them documented at https://nominatim.org/release-docs/latest/admin/ . PHP will be removed in future versions.
You asked a question in the media docker repository so I'm guessing you use their docker image. That still uses PHP.
NOMINATIM_API_POOL_SIZE
is configurable (https://nominatim.org/release-docs/latest/customize/Settings/#nominatim_api_pool_size) for the Python frontend. I haven't looked closely at tuning the parameter, so far increasing themax_connections
in Postgres worked well enough for me.