greenpeace / planet4

Built on top of Wordpress tech, Greenpeace Planet 4 powers digital platforms to engage with millions and win campaigns around the world.
https://planet4.greenpeace.org
Creative Commons Attribution Share Alike 4.0 International
67 stars 27 forks source link

P4 Dev Env is SLOW AS (like 16 second page load time) - seems to be caused by elasticpress #186

Closed techieshark closed 9 months ago

techieshark commented 9 months ago

Where did you find the bug?

http://www.planet4.test/

What went wrong?

Page load time is 16+ seconds

Here's the problem:

Observe that a simple front page request takes a long time (over 10 seconds)

time curl -I http://www.planet4.test/
...
curl -I http://www.planet4.test/  0.00s user 0.01s system 0% cpu 16.299 total
  1. open docker desktop and go to 'Containers'
  2. pick the CLI container
  3. navigate to the "Exec" tab
  4. run time wp plugin list
  5. Observe it is very slow - like 10 seconds

image

  1. Run wp plugin deactivate elasticpress
  2. Again run time wp plugin list
  3. Observe that it is now much faster (less than 1 second)

After this, observe that the page load time is much faster - less than 1 second.

time curl -I http://www.planet4.test/
...
curl -I http://www.planet4.test/  0.00s user 0.00s system 3% cpu 0.252 total

Now run wp plugin activate elasticpress And again run time wp plugin list and observe that it's back up to 10+ seconds

Using query-monitor wp plugin, we see: image

So the issue is caused by some elasticpress network requests which time out.

We can track down why elasticpress is making those requests by looking at the plugin setting page:

image

"There is a problem with connecting to your Elasticsearch host. ElasticPress can try your host again, or you may need to change your settings. Response error: cURL error 28: Resolving timed out after 5002 milliseconds"

http://elasticsearch-data.elastic.svc.cluster.local:9200/

Where does this value come from?? See https://support.greenpeace.org/planet4/tech/elasticsearch

image

Do you have screenshots?

Screenshots above