# How trivago Reduced Memcached Memory Usage by 50%

DevFeed: [How trivago Reduced Memcached Memory Usage by 50%](<https://devfeed.tech/articles/how-trivago-reduced-memcached-memory-usage-by-50-27956.md>)

Original publisher: [Read original article](<https://tech.trivago.com/post/2017-12-19-memcached-optimization/>)

Author: Ivana Petrovic Software backend developer; Optimisation; Clean Architecture

Published: 2017-12-19T00:00:00Z

Content type: article

Language: en

Sources: [Trivago](<https://devfeed.tech/sources/trivago.md>)

Topics: [Caching](<https://devfeed.tech/topics/caching.md>), [Code](<https://devfeed.tech/topics/code.md>), [PHP](<https://devfeed.tech/topics/php.md>), [Logging](<https://devfeed.tech/topics/logging.md>), [Network](<https://devfeed.tech/topics/network.md>), [Database](<https://devfeed.tech/topics/database.md>)

Tags: [backend](<https://devfeed.tech/tags/backend.md>), [cache](<https://devfeed.tech/tags/cache.md>), [caching](<https://devfeed.tech/tags/caching.md>), [downtime](<https://devfeed.tech/tags/downtime.md>), [errors](<https://devfeed.tech/tags/errors.md>), [high-performance](<https://devfeed.tech/tags/high-performance.md>), [logging](<https://devfeed.tech/tags/logging.md>), [memcached](<https://devfeed.tech/tags/memcached.md>), [memory](<https://devfeed.tech/tags/memory.md>), [network](<https://devfeed.tech/tags/network.md>), [performance](<https://devfeed.tech/tags/performance.md>), [php](<https://devfeed.tech/tags/php.md>), [profiling](<https://devfeed.tech/tags/profiling.md>), [uptime](<https://devfeed.tech/tags/uptime.md>)

## AI overview

trivago describes how a Memcached cache failure caused database overload and platform downtime during a botnet-driven spike in spider traffic. The team added cache-value-size logging, used Blackfire profiling, and found that a method was caching about 10 MB of data and being called 30 times per page load.

## Source excerpt

One day, Memcached ran out of free memory. The method `get` failed and all requests went directly to the database. Of course these calls also failed under the huge load, and eventually it caused downtime for the whole trivago website. Yikes!