Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server takes too long to respond #1256

Closed
jc-harrison opened this issue Sep 10, 2019 · 2 comments · Fixed by #1918
Closed

Server takes too long to respond #1256

jc-harrison opened this issue Sep 10, 2019 · 2 comments · Fixed by #1918
Labels
FlowAPI Issues related to the FlowKit API FlowMachine Issues related to FlowMachine performance

Comments

@jc-harrison
Copy link
Member

The first time an EventsTablesUnion object is constructed, all events tables for all available dates are "added to cache" (i.e. the query IDs for the corresponding Table objects are added to cache.cached, and the query state is set to completed in redis). This process can take several seconds.

As query object construction in the FlowMachine server happens on the main thread, before creating a separate thread to run the query, this is a blocking operation and causes the server to wait several seconds before responding. In some cases (e.g when building the docs without running the pre-cache script) this wait is too long and results in FlowClient raising:

FlowclientConnectionError: Unable to connect to FlowKit API at http://localhost:9090: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
@jc-harrison jc-harrison added FlowMachine Issues related to FlowMachine FlowAPI Issues related to the FlowKit API performance labels Sep 10, 2019
@greenape
Copy link
Member

greenape commented Sep 11, 2019

This is actually pretty serious I think - Hypercorn's default timeout is, I believe, 5s.

At present, while the flowmachine server is async it largely operates serially - so that means that if your request is in a queue which is going to take more than 5s to get through, you'll error out.

In principle, adding a sleep(4) inside Query's __init__ for example, and then firing off two distinct run query requests should make the second fail, and will definitely make any third request fail.

@greenape
Copy link
Member

So that gives us two issues:

  1. Query object creation can be pretty slow
  2. Even if query object creation is pretty fast, it blocks the server from responding, so even if it took 1s on average you'd hit this issue with quite a small number of unique run query requests close together.

@greenape greenape mentioned this issue Sep 11, 2019
8 tasks
@greenape greenape mentioned this issue Feb 6, 2020
8 tasks
@mergify mergify bot closed this as completed in #1918 Feb 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FlowAPI Issues related to the FlowKit API FlowMachine Issues related to FlowMachine performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants