Hi Ilya, Part of the ignite spec is setting a memory cap on the queue via the CollectionConfiguration. If this isn’t implemented it’s a bug, if it’s not intended to be implemented it’s at least a doc bug. I don’t see how that’s possible though since collectionConfiguration seems very specific to ignite distributed data structures.
Wrt setting a cap vs max memory size - Although it’s indeed natural to set a cap using a number that doesn’t help account for memory resource limits. It’s extremely difficult to dynamically calculate the memory used on a set of objects. Therefore arbitrarily setting a number like 100k as the cap for a queue has little meaning if the ignite memory segment cannot hold that much memory or it sets up a scenario where the queue is competing with other caches in the system. IMO setting a memory target is more ideal for this reason. Scott On Tue, Nov 2, 2021 at 19:52 Ilya Korol <llivezk...@gmail.com> wrote: > Hi Bharath. > > I've checked the sources and looks like method > CollectionConfiguration.getOffHeapMaxMemory() is never called, so the > only way to restrict queue capacity is to use capacity parameter of > ignite.queue(). > > One can argue about it, but this looks quite natural to restrict queue > by elements count instead of memory, however feel free to submit a JIRA > ticket if you consider this as a flaw. > > > On 2021/11/01 22:28:27 Bharath Kumar Suresh wrote: > > Hello, > > > > I'm trying to set a maximum limit on the memory (not in terms of the > number > > of elements) of an ignite queue using > > CollectionConfiguration::setOffHeapMaxMemory > > > < > https://github.com/apache/ignite/blob/5c189a932d53a5c971d859b6ecd1098ad1da831c/modules/core/src/main/java/org/apache/ignite/configuration/CollectionConfiguration.java#L157 > >. > > The snippet below is how I try to achieve the same: > > > > CollectionConfiguration queueConfiguration = new > > CollectionConfiguration(); > > > > > queueConfiguration.setOffHeapMaxMemory(DataSize.ofMegabytes(2L).toBytes()); > > ignite.queue("test-queue", 0, queueConfiguration); > > > > As seen above, I set the cap parameter to 0 since I want to define > the size > > of the queue in terms of actual memory (2MB in the above example) and > not > > the number of elements in the queue. > > > > But somehow this setting doesn’t restrict the actual size of the queue. > > What am I missing? Could someone please help? > > > > Thanks, > > Bharath > > >