Performance, Latency & Regions

You can view the current API status on the Status Page.

You can expect your feed to load in about 10ms. The most common cause of slower performance is latency. You can improve this by selecting the closest data center to you.

Stream is currently available in different locations. When you create an application, you should select the region that is closest to you to get the best latency:

  • US - Ohio: ohio

  • Europe West - Ireland: dublin

  • Asia - Singapore: singapore

  • Asia - Tokyo: tokyo

  • Asia - Mumbai: mumbai

Make sure you provide your application region when initializing the client:

client = Stream::Client.new('{{ api_key }}','{{ api_secret }}', '{{ app_id }}', :location => 'ohio')

Enrichment & Performance

Another common cause of slow feed performance is the enrichment step. Often you’ll send references to your database in the activities. When loading your feed you need to run specific database queries to load the latest version of this data.

In cases like this, there are three things to keep in mind:

  1. Batch all the database queries. Never run N queries for N items in the feed.

  2. Cache the lookup using the primary key with a model layer cache (recommended only for large apps).

  3. Use Stream collections and user endpoints to store data and get the best performance.

More information on how enrichment works can be found here.

© Getstream.io, Inc. All Rights Reserved.