You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The OHM website is under heavy load (queue full) #850
Comparing what is shown in the Prometheus stats, none of the containers are hitting the maximum values of the resources. Maybe something else is going on, or some configuration still needs to be fixed to use the resources of the containers to their maximum potential.
cc. @batpad
As a user, without supporting data, it "feels" like the relation query fix is still a problem.
Uploads are very zippy for when ways and nodes are getting uploaded.
Relations still bog down the upload process. This was not the case briefly recently, while we applied fixes from mmd & bitner, but it seems these issues have reappeared. It's almost like an A/B/A test the difference is so clear.
hey @mmd-osm, could you help us with other question? . Yesterday, I set the following values in OHM database:
set enable_mergejoin=false;
set enable_hashjoin=false;
SELECT pg_reload_conf();
It seems it only applies for the session where i was, not for the whole database. because i see the values today and show enable_mergejoin=on.
I read that to apply these values to the whole database, we need to set them up in the postgresql.conf file. do you apply the settings for the hole OSM database?
Since CGImap uses libpqxx which in turn uses libpq, this should work. I double checked if PGOPTIONS is taken into account when running in CGImap in daemon mode, and defined a statement timeout of 1s. This should kick in for bigger ways/relations updates, and that's exactly what I've seen in the log files below.
@Rub21 - I just did a large upload on staging that seemed to work quite well... unless it is what brought down staging. The upload portion worked quite well before the site went down. Please let me know when you're ready for me to try again.
Ok, this looks better. I was struggling a bit to make some sense of the SELECT * FROM pg_stat_activity query. I think what you see there in columns enable_mergejoin + enable_hashjoin depends on the database connection you were using to run that query in some admin tool. It doesn't represent the settings that were in place when CGImap executed the query.
Following Jeff’s comments and my testing, the large changeset uploads are now working efficiently and take less than a minute to complete. This issue was challenging, but I gained valuable experience managing Postgres. PGOPTIONS works fine in cgimap, but it was necessary to clean and update the table statistics to make enable_mergejoin and enable_hashjoin effective. Running the following queries improved update times significantly, reducing changeset processing from 15 minutes to 0.18 minutes. For future migrations, it’s recommended to run these commands.
Activity
Rub21 commentedon Jul 18, 2024
Conducting an evaluation of the containers regarding the high usage:
There is a high usage of resources at ~ 05:32 UTC, and only user jeffmeyer has been uploading large changesets to the website.
Rub21 commentedon Jul 18, 2024
This issue could be due to the proxy timeout, but currently, Ingress is configured to support 20 minutes of proxy and 200MB of data transfer https://github.com/developmentseed/osm-seed/blob/develop/osm-seed/templates/web/web-ingress.yaml#L7-L12 . I’ve just opened a PR that updates the proxy timeout values to 20 minutes in the Apache config: OpenHistoricalMap/ohm-deploy#347
Rub21 commentedon Jul 18, 2024
Also, for more clarification about the resource usage for each web API container, here is the configuration: https://github.com/OpenHistoricalMap/ohm-deploy/blob/main/values.production.template.yaml#L150-L157
Comparing what is shown in the Prometheus stats, none of the containers are hitting the maximum values of the resources. Maybe something else is going on, or some configuration still needs to be fixed to use the resources of the containers to their maximum potential.
cc. @batpad
jeffreyameyer commentedon Jul 18, 2024
As a user, without supporting data, it "feels" like the relation query fix is still a problem.
Uploads are very zippy for when ways and nodes are getting uploaded.
Relations still bog down the upload process. This was not the case briefly recently, while we applied fixes from mmd & bitner, but it seems these issues have reappeared. It's almost like an A/B/A test the difference is so clear.
Rub21 commentedon Jul 18, 2024
hey @mmd-osm, could you help us with other question? . Yesterday, I set the following values in OHM database:
It seems it only applies for the session where i was, not for the whole database. because i see the values today and show
enable_mergejoin=on.I read that to apply these values to the whole database, we need to set them up in the
postgresql.conffile. do you apply the settings for the hole OSM database?cc @batpad
mmd-osm commentedon Jul 18, 2024
The code to disable merge and hash joins in CGImap changes the current session only (this was done for the /map endpoint, it does not change the upload behavior). I just checked the OSM chef repo, and don't find these settings on a global level: https://github.com/openstreetmap/chef/blob/master/cookbooks/postgresql/templates/default/postgresql.conf.erb
Changing the setting on a global level needs more testing, since it might impact other unrelated queries, which were doing fine previously.
Rub21 commentedon Jul 19, 2024
@mmd-osm I was investigating how to enable the set enable_mergejoin=false; only for the CGImap process. I did something like this : https://github.com/OpenHistoricalMap/ohm-deploy/blob/main/images/web/cgimap.sh#L30-L32 It did not work, also I did not find documentation on how to enable it. Is it some ENV var that runs this? , Also, since it is in the CGImap code, should those lines be enabled automatically, or at which step will these lines be executed?
mmd-osm commentedon Jul 20, 2024
Since CGImap uses libpqxx which in turn uses libpq, this should work. I double checked if PGOPTIONS is taken into account when running in CGImap in daemon mode, and defined a statement timeout of 1s. This should kick in for bigger ways/relations updates, and that's exactly what I've seen in the log files below.
You could also add auto explain to your postgresql.conf and later evaluate slow queries in /var/log/postgresql/postgresql-xx-main.log logfile.
Settings: https://www.postgresql.org/docs/current/runtime-config-query.html
Both
enable_seqscan=offandjit=offmight be interestingjeffreyameyer commentedon Jul 22, 2024
@Rub21 - please let me know when this is done and the site is ready for another test. I am eager to get this one closed. : )
jeffreyameyer commentedon Jul 25, 2024
@Rub21 - I just did a large upload on staging that seemed to work quite well... unless it is what brought down staging. The upload portion worked quite well before the site went down. Please let me know when you're ready for me to try again.
Rub21 commentedon Jul 25, 2024
@mmd-osm I have libpqxx-dev as dependencies https://github.com/OpenHistoricalMap/ohm-deploy/blob/main/images/web/Dockerfile#L28, but still it did not take the PGOPTIONS
export PGOPTIONS="-c enable_mergejoin=false -c enable_hashjoin=false"I am testing it using the follow query:
Rub21 commentedon Jul 25, 2024
i tested the timeout in the PGOPTIONS, seems it works because of the logs returns 👇
mmd-osm commentedon Jul 25, 2024
Ok, this looks better. I was struggling a bit to make some sense of the
SELECT * FROM pg_stat_activityquery. I think what you see there in columnsenable_mergejoin+enable_hashjoindepends on the database connection you were using to run that query in some admin tool. It doesn't represent the settings that were in place when CGImap executed the query.jeffreyameyer commentedon Jul 26, 2024
Who - just uploaded a lot of data changesets 131797 - 131809. Looks like everything went just fine, which is much different from before.
I'd be interested if the logs show anything unusual, both for query and writes, etc., as well as CPU loads.
Rub21 commentedon Jul 26, 2024
Following Jeff’s comments and my testing, the large changeset uploads are now working efficiently and take less than a minute to complete. This issue was challenging, but I gained valuable experience managing Postgres. PGOPTIONS works fine in cgimap, but it was necessary to clean and update the table statistics to make enable_mergejoin and enable_hashjoin effective. Running the following queries improved update times significantly, reducing changeset processing from 15 minutes to 0.18 minutes. For future migrations, it’s recommended to run these commands.
Huge thanks to @mmd-osm for your support on this issue.
cc. @batpad @danrademacher
Rub21 commentedon Jul 31, 2024
Closing this ticket, the issue has been resolved.
danrademacher commentedon Jul 31, 2024
Awesome work!