Kong Gateway's memory behavior with Docker + DBLess mode

Hellk

We just migrated our Kong Gateway 2.4.1 installation from the Cassandra backend to the DBLess backend.

We are running Kong via the official kong:2.4.1-alpine Docker image and we observed a difference in the way Kong is using memory. In each case, we are reserving 2 GB of memory for every Kong instance that we are executing:

  • Previously (while using the Cassandra backend), when Kong started, it was allocating about 1 GB of memory. Then, the memory consumption was slowly increasing up to 2 GB (sometimes, but rarely, going above and getting killed by the out of memory killer of the kernel)
  • With the new DBLess setup, running the same Kong version and using the same data, we observed that Kong allocates directly just slightly less than what the memory reserved to the Docker container (1.95 GB in our case). Then, the memory used doesn’t change at all during the lifetime of the container.
  • For the sake of testing, we tried to play a bit with the memory limits of the containers, and in every cases, with the DBLess setup, Kong seems to limit itself to the memory reserved by Docker.

It looks like somehow Kong has the knowledge of the memory reserved for the container and handles itself well by not going above, but I couldn’t find any place to confirm this.

Is this automatic memory management using Docker memory limits an expected behavior? Where can I find more information about this, in particular which component within Kong detects these limits?


© 2019 Kong Inc.    Terms  •  Privacy  •  FAQ