HDDS-9803. Limit total number of buckets to avoid OutOfMemoryError in OM#5705
HDDS-9803. Limit total number of buckets to avoid OutOfMemoryError in OM#5705sadanand48 merged 18 commits intoapache:masterfrom
Conversation
|
@sumitagrawl can you check if the test failures are related? |
|
This is a direct and efficient solution. |
Thanks @xichen01 for review, bucket is full cache table, and for performance, it was cached.
So IMO, its not viable to make bucket as partial cache. |
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @sumitagrawl for working on this.
Shouldn't we also limit volumes at the same time? Creating too many volumes can also result in OOME.
| </description> | ||
| </property> | ||
| <property> | ||
| <name>ozone.om.max.bucket</name> |
There was a problem hiding this comment.
Nit: ozone.om.max.buckets.
|
|
||
| @Override | ||
| public long getEstimatedKeyCount() throws IOException { | ||
| if (cache instanceof FullTableCache) { |
There was a problem hiding this comment.
I'd prefer adding CacheType type() in TableCache, and using cache.type() == FULL_CACHE instead of instanceof check.
| long nrOfBuckets = ozoneManager.getMetadataManager().getBucketTable() | ||
| .getEstimatedKeyCount(); | ||
| if (nrOfBuckets >= maxBucket) { | ||
| throw new OMException("Number of bucket crosses limit " + |
There was a problem hiding this comment.
Nit: I think "Cannot create more than " + maxBucket + " buckets" would be a better message.
We already have max number of volume per user restriction, "ozone.om.user.max.volume" with default value 1024. May be this is enough. |
adoroszlai
left a comment
There was a problem hiding this comment.
Thanks @sumitagrawl for updating the patch.
We already have max number of volume per user restriction, "ozone.om.user.max.volume" with default value 1024. May be this is enough.
Yes, I agree, that's probably fine.
|
@sumitagrawl can you please resolve the conflicting files? |
done |
sadanand48
left a comment
There was a problem hiding this comment.
Thanks for the patch @sumitagrawl , LGTM
|
Thanks @sumitagrawl for the change , @xichen01, @adoroszlai for the reviews. |
What changes were proposed in this pull request?
limit the number of buckets with default to 100000, to avoid OOM when huge number of buckets are created. This is as buckets are full cached in OM.
Its observed that 1 bucket Info consume approx 1KB memory, so 100,000 buckets will take up 100MB approx, so 100,000 is chosen as default and handle most of the usecase.
What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-9803
How was this patch tested?