You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "simonbence (via GitHub)" <gi...@apache.org> on 2023/12/13 10:54:47 UTC

[PR] NIFI-12509 Changing default TTL of HazelcastMapCacheClient [nifi]

simonbence opened a new pull request, #8154:
URL: https://github.com/apache/nifi/pull/8154

   Current default TTL is 0, which in terms of Hazelcast means that the cache will be ever-growing. Having Max Size Policy on the imap (backs the cache) can be reached via instance (server side) so it looks to be a valid setup to user 0 TTL. This makes it unreasonable to not allow the value at this point. Note: `EmbeddedHazelcastCacheManager` has currently no opportunity to set such a Max Size Policy.
   
   # Summary
   
   [NIFI-12509](https://issues.apache.org/jira/browse/NIFI-12509)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [ ] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [ ] Pull Request based on current revision of the `main` branch
   - [ ] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [ ] Build completed using `mvn clean install -P contrib-check`
     - [ ] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12509 Changing default TTL of HazelcastMapCacheClient [nifi]

Posted by "asfgit (via GitHub)" <gi...@apache.org>.
asfgit closed pull request #8154: NIFI-12509 Changing default TTL of HazelcastMapCacheClient
URL: https://github.com/apache/nifi/pull/8154


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12509 Changing default TTL of HazelcastMapCacheClient [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on code in PR #8154:
URL: https://github.com/apache/nifi/pull/8154#discussion_r1426583899


##########
nifi-nar-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java:
##########
@@ -78,10 +78,11 @@ public class HazelcastMapCacheClient extends AbstractControllerService implement
             .name("hazelcast-entry-ttl")
             .displayName("Hazelcast Entry Lifetime")
             .description("Indicates how long the written entries should exist in Hazelcast. Setting it to '0 secs' means that the data" +
-                    "will exists until its deletion or until the Hazelcast server is shut down.")
+                    "will exists until its deletion or until the Hazelcast server is shut down. Using `EmbeddedHazelcastCacheManager` as" +
+                    "cache manager will not provide policies to limit the size of the cache.")
             .required(true)
             .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
-            .defaultValue("0 secs") // Note: in case of Hazelcast IMap, negative value would mean "map default" which might be overridden by a different client.
+            .defaultValue("5 min") // Note: in case of Hazelcast IMap, negative value would mean "map default" which might be overridden by a different client.

Review Comment:
   @simonbence Thanks for the clarification!
   
   +1 LGTM



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12509 Changing default TTL of HazelcastMapCacheClient [nifi]

Posted by "simonbence (via GitHub)" <gi...@apache.org>.
simonbence commented on code in PR #8154:
URL: https://github.com/apache/nifi/pull/8154#discussion_r1426407692


##########
nifi-nar-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java:
##########
@@ -78,10 +78,11 @@ public class HazelcastMapCacheClient extends AbstractControllerService implement
             .name("hazelcast-entry-ttl")
             .displayName("Hazelcast Entry Lifetime")
             .description("Indicates how long the written entries should exist in Hazelcast. Setting it to '0 secs' means that the data" +
-                    "will exists until its deletion or until the Hazelcast server is shut down.")
+                    "will exists until its deletion or until the Hazelcast server is shut down. Using `EmbeddedHazelcastCacheManager` as" +
+                    "cache manager will not provide policies to limit the size of the cache.")
             .required(true)
             .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
-            .defaultValue("0 secs") // Note: in case of Hazelcast IMap, negative value would mean "map default" which might be overridden by a different client.
+            .defaultValue("5 min") // Note: in case of Hazelcast IMap, negative value would mean "map default" which might be overridden by a different client.

Review Comment:
   The original default value (0) is handled as "no expiration" by Hazelcast. This is by itself not something we should worry about so I intend to keep it an allowed value. Together with the `EmbeddedHazelcastCacheManager` which is one of the simplest way to back the cache this results an ever growing memory consumption. The case is the same with external Hazelcast instances where no Max Size Policy is set for the iMap behind. So having a reasonable staring value looks to be more safe as users needs to think about the expected TTL instead of just leaving it on a seemingly innocent value.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] NIFI-12509 Changing default TTL of HazelcastMapCacheClient [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on code in PR #8154:
URL: https://github.com/apache/nifi/pull/8154#discussion_r1425785361


##########
nifi-nar-bundles/nifi-hazelcast-bundle/nifi-hazelcast-services/src/main/java/org/apache/nifi/hazelcast/services/cacheclient/HazelcastMapCacheClient.java:
##########
@@ -78,10 +78,11 @@ public class HazelcastMapCacheClient extends AbstractControllerService implement
             .name("hazelcast-entry-ttl")
             .displayName("Hazelcast Entry Lifetime")
             .description("Indicates how long the written entries should exist in Hazelcast. Setting it to '0 secs' means that the data" +
-                    "will exists until its deletion or until the Hazelcast server is shut down.")
+                    "will exists until its deletion or until the Hazelcast server is shut down. Using `EmbeddedHazelcastCacheManager` as" +
+                    "cache manager will not provide policies to limit the size of the cache.")
             .required(true)
             .addValidator(StandardValidators.TIME_PERIOD_VALIDATOR)
-            .defaultValue("0 secs") // Note: in case of Hazelcast IMap, negative value would mean "map default" which might be overridden by a different client.
+            .defaultValue("5 min") // Note: in case of Hazelcast IMap, negative value would mean "map default" which might be overridden by a different client.

Review Comment:
   @simonbence What is the exact reason for changing the default value?
   Some processors store state-like data using `DistributedMapCacheClient` and they do not want to loose the cached items after some expiration time. So the default 0 (no TTL) looks reasonable for me. The user can change it if they have a different use case.
   It may make sense to allow "no value" for the property and use the map default in that case (negative value in the Hazelcast API). As far as I understand, currently it is not possible to fall back to the default server side setting of the map.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org