index.rst 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. Update Buffers
  2. ==============
  3. Sentry provides the ability to buffer certain updates to events, such as counts and timestamps. This is
  4. extremely helpful if you have high concurrency, especially if they're frequently the same event.
  5. For example, if you happen to receive 100,000 events/second, and 10% of those are reporting a connection
  6. issue to the database (where they'd get grouped together), enabling a buffer backend will change things
  7. so that each count update is actually put into a queue, and all updates are performed at the rate of how
  8. fast the queue can keep up.
  9. Choosing a Backend
  10. ------------------
  11. To specify a backend, simply modify the ``SENTRY_BUFFER`` and ``SENTRY_BUFFER_OPTIONS`` values in your configuration:
  12. ::
  13. SENTRY_BUFFER = 'sentry.buffer.base.Buffer'
  14. SENTRY_BUFFER_OPTIONS = {
  15. 'delay': 5, # delay for queued tasks
  16. }
  17. The Redis Backend
  18. -----------------
  19. Configuring the Redis backend **requires the queue** or you won't see any gains (in fact you'll just negatively
  20. impact your performance).
  21. The first thing you will need to do is install a few additional required packages:
  22. ::
  23. pip install redis hiredis nydus
  24. Finally, configure the buffer options:
  25. ::
  26. SENTRY_BUFFER = 'sentry.buffer.redis.RedisBuffer'
  27. SENTRY_BUFFER_OPTIONS = {
  28. 'hosts': {
  29. 0: {
  30. 'host': 'localhost',
  31. 'port': 6379
  32. }
  33. }
  34. }
  35. Because the Redis buffer relies on the Nydus package, this gives you the ability to specify multiple nodes and
  36. have keys automatically distributed. It's unlikely that you'll need this functionality, but if you do, a simple
  37. configuration might look like this:
  38. ::
  39. SENTRY_BUFFER_OPTIONS = {
  40. 'hosts': {
  41. 0: {
  42. 'host': '192.168.1.1'
  43. }
  44. 1: {
  45. 'host': '192.168.1.2'
  46. }
  47. },
  48. }
  49. With the default configuration this will distribute keys using a simple partition router (relatively even
  50. distribution).