How Do I Avoid Big Keys and Hot Keys?

  • Keep the size of Strings within 10 KB and the quantity of Hashes, Lists, Sets, or Zsets within 5000.
  • When naming keys, use the service name abbreviation as the prefix and do not use special characters such as spaces, line brakes, single or double quotation marks, and other escape characters.
  • Do not rely too much on Redis transactions.
  • The performance of short connections is poor. Use clients with connection pools.
  • Do not enable data persistence if you use Redis just for caching and can tolerate data losses.