Very large graph does not load when hosted

Hi, I have a very large graph (millions of vertices) and was wondering if anyone has advice on how to host a project with it. Right now I have the graph unzip and unpickle on a Flask server when the frontend is first rendered, and then I use the shortest path functionality of the graph throughout the app state. Everything works perfectly fine locally, but the request never finishes on the hosted site. I was looking into maybe storing the graph in an s3bucket but not sure what format that should be in. I appreciate any advice!

How much time does it take to unpickle the graph? I suspect that you are running into some kind of a timeout, i.e. the client (the browser) decides to abandon the request because it takes too much time to unpickle the graph.

I’d try to unpickle and load the graph during app startup, and start serving requests only when the graph is ready. Alternatively, if you need fast startup, do the unpickling on a separate thread and dispatch an event to the main thread serving requests when the unpickling is ready. For incoming requests that happen during the time you are still unpickling the graph, you can respond with an HTTP 503 (Service Unavailable) error code.