grandecola / bigqueue

Embedded, Fast and Persistent bigqueue implementation
MIT License
444 stars 31 forks source link

Add support for configuring bigqueue #5

Closed mangalaman93 closed 6 years ago

mangalaman93 commented 6 years ago

We should use a Config object to allow configuring BigQueue. We should allow a useful default value for each configuration as well as ensure that configurations are set correctly using possible checks around each parameter. We should allow creating bigqueue without the config object using the default values.

Here is the list of configuration parameters -

We will have to persist the configuration parameters so that we can read these parameters back across different invocation of same application.

I still think that we should keep the directory as an argument to NewBigQueue to ensure an explicit invocation of creating a queue using a path. Given that path is what defines a BigQueue, the expectation will be set properly in that if you lose the directory, you lose the queue

mangalaman93 commented 6 years ago

Maximum size of Arena < total system memory / 4 so that we leave some memory for OS and ensure that we can keep 2 Arenas in memory for the queue.

mangalaman93 commented 6 years ago
Whether Persist Update Allowed Max Value Min Value
Maximum Size of Arena yes no Maximum Size of Arena < Total System Memory / 4 OS Page Size
Maximum Memory Used by BigQueue No yes Total System Memory 2 * Arena Size
GC frequency No yes - -
mangalaman93 commented 6 years ago

References

  1. https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
  2. https://commandcenter.blogspot.com/2014/01/self-referential-functions-and-design.html