The Gateway feature is available only in Countly Enterprise as a paid add-on for clients with Google Cloud hosting.

Gateway is a feature designed to handle high traffic spikes by processing the requests consistently and maintaining preset threshold levels of traffic. With Gateway, server traffic is managed more efficiently, ensuring the server is never down.

Benefits of Gateway

Most Countly servers have relatively homogenous and manageable traffic throughout the day, but in certain cases, the number of requests can increase up to 10x times. This leads to planning the deployment to be able to handle that 10x traffic, which ends up being too complex to maintain and expensive for the customer. But the Gateway feature can auto-adjust the rate at which the data is sent to the API, and thus deployment planning can be done for average traffic.

By default, Countly operates in real-time. However, some clients might find it acceptable to visualize data with several hours of delay, using the Gateway feature to have a less complicated or expensive deployment.

Gateway stores all the requests for a specific time period for debugging. Then, it analyzes the requests and sends them using the gateway. If there is a data overload in one server, the incoming data requests are sent to another Countly server.

Getting Started

First of all,  in the Sidebar, go to Management > Feature Management and enable the toggle buttons for the Gateway Monitor and the Gateway Processor. You can review their differences in the section below.

If necessary, go to Management > Settings and update the necessary settings related to the Gateway feature, with the correct configurations.

Feature Components

Gateway is internally using Google Pub/Sub as a message, and it has 3 services: Cloud Publisher, Processor, and Monitor.

Gateway Cloud Publisher

The Gateway Cloud Publisher is where all the write requests are diverted using Nginx rules. After getting all the requests, it is responsible for basic validation and publishing into the queue.

Gateway Processor

The Gateway Processor pulls the requests from the queue based on the calculated request processing per minute, which is used for throttling. It has an auto-adjusting, rate-limiting algorithm that can handle the traffic based on the capacity. After pulling the requests, it sends the request to the request processor to process the request.

Gateway Monitor

The Gateway Monitor has a monitoring dashboard to see how all the requests are processed. It shows the incoming requests against the processed requests and also shows the delay.


A throttle is a process of controlling the number of API requests a user can make in a certain period where an application programming interface (API) functions as a gateway between a user and a software application. The primary purpose of the throttle is to avoid network congestion.

Working Process of Gateway

The sequential process of Gateway operates as follows:

  1. The requests that come from Countly and the SDKs included in your application are sent to the Nginx server, which acts as a load balancer. 
  2. Nginx routes client requests across all servers, capable of fulfilling those requests in a manner that maximizes speed and resource utilization. It also ensures that no server is overloaded, which can slow down the server’s performance.
  3. Then, the requests are sent to the Gateway Publisher.
  4. The requests are arranged in a queue and sent to the Countly platform, which interacts to and fro with the backend database. Thus, it manages the traffic without any network congestion.

Below is a diagram showing the process:


Gateway Overview

Using Gateway

You can find the Gateway feature in Management > Gateway, where you will the view below:


Here, you will find the following elements:

  1. Throttle Activity: Shows the existing throttle and its average processing flow. You can define the throttle in the global and application-level settings, which are noted below.
  2. Gateway Activity graph: Indicates the number of incoming requests to the Gateway, the number of requests the Gateway has processed, and the number of failed requests i.e., the requests that were not processed.
  3. Global Settings: shows all the settings of the Gateway and the APIs. They can be edited via the Edit button in the top-right corner.
  4.  Application Level Settings: Allows you to define the throttle level.

Looking for help?