contentful / contentful.py

Python client for the Contentful Content Delivery API https://www.contentful.com/developers/documentation/content-delivery-api/
MIT License
45 stars 39 forks source link

Using the Contentful Python client adds significant latency #93

Closed kyle-kc closed 1 month ago

kyle-kc commented 3 months ago

We are using the delivery client and querying for entries using the entries() method. We are seeing significant latency from this method call that far exceeds the time for the HTTP request to return from Contentful's servers. In general, the HTTP request is taking around ~200 ms while the total time for entries() to return is between 3 and 4 seconds. This is making the client unusable for our production applications.

We further verified this by making the same exact call twice: once with raw_mode set to False and once with raw_mode set to True. When raw_mode is set to False, the method takes almost 10 times as long as when raw_mode is set to True.

If it's helpful, our space ID is skxj1h7bf8uk and the entry we are querying is 77EtShHXyEPlXpTJFr9teZ. We are using many linked entries and cross-space references. It seems to be easy to reproduce with any entry that links to many (20+) other entries.

rubydog commented 3 months ago

Hi @kyle-kc

Thank you for providing the details about the latency issue you're experiencing with the entries() method. Given the significant difference in response times between raw_mode settings and the context of linked entries and cross-space references, it might be helpful to check and adjust the following configuration settings to improve performance:

max_include_resolution_depth: This setting controls how deep the client will resolve linked entries. Reducing this depth can help decrease processing time if you have a lot of nested references. reuse_entries: This setting determines whether the client reuses already retrieved entries. Enabling this can help reduce redundant data processing and improve response times. You can try adjusting these settings in your delivery client configuration and see if it helps in reducing the latency.

If you continue to experience issues or need further assistance, please let me know!

Cheers

rubydog commented 1 month ago

Closing this issue for now due to lack of response. Please reopen if the problem persists.