PGBI / kong-dashboard

Dashboard for managing Kong gateway
MIT License
2.18k stars 391 forks source link

Configurable Proxy Timeout in Kong Dashboard #118

Open ericachelis opened 6 years ago

ericachelis commented 6 years ago

The /consumers screen fails to load on the kong dashboard because the proxy_timeout is set to 3 seconds.

We have about 25 million consumers in our Kong Database. A call to the Kong API to list all consumers takes roughly 10 seconds (this is how long it takes to do a select COUNT(*) from consumers; in our postgres backed kong instance).

We would like to be able to configure this value in kong-dashboard so our consumer screen loads.

subnetmarco commented 6 years ago

The underlying issue is that the API counts the total number of entities in the datastore on every page load, and that can take a long time in Kong (this is the reason we also removed counters in /status, https://github.com/Mashape/kong/pull/2554).

We should either remove the total count or optimize it in order to fix this issue in the long term.

In the meanwhile the timeout value can be increased by updating the underlying nginx template. Instructions at https://getkong.org/docs/0.10.x/configuration/#custom-nginx-configuration-embedding-kong

ericachelis commented 6 years ago

Following up here. The timeout I believe I am hitting is not the kong service controlled by the nginx template. API calls to the /consumers endpoint on kong succeed (and take about 10 seconds).

The timeout that would be nice to configure is within the kong-dashboard project and configured on the reverse proxy used by kong-dashboard: https://github.com/PGBI/kong-dashboard/blob/2a6c66438f2e2891e6d6edd0ba1595c88ac9ff22/bin/server.js#L60

API calls to the /consumer endpoint via the kong-dashboard proxy fail after about 3 seconds.

PGBI commented 6 years ago

@ericachelis The way kong-dashboard configuration is done has become a bit messy (some options are configurable through arguments on kong-dashboard start --my-arg=xxx, others through environment variables, some others through the Kong-dashboard UI itself)...

I need to refactor all that, but I'm lacking time at the moment unfortunately.

As a short term solution, I'm going to increase the hard coded timeout from 3 to 30 seconds. Hope this will fix your issue.

PGBI commented 6 years ago

So timeout was increased in version 2.2.0. I'm leaving this ticket opened to remember to make this a configurable parameter.