nifi-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [nifi] not-for-me commented on a change in pull request #3511: NIFI-6175 Spark Livy - Improving Livy
Date Mon, 04 Nov 2019 02:37:32 GMT
not-for-me commented on a change in pull request #3511: NIFI-6175 Spark Livy - Improving Livy
URL: https://github.com/apache/nifi/pull/3511#discussion_r341889543
 
 

 ##########
 File path: nifi-nar-bundles/nifi-spark-bundle/nifi-livy-controller-service/src/main/java/org/apache/nifi/controller/livy/LivySessionController.java
 ##########
 @@ -389,9 +428,22 @@ private void manageSessions() throws InterruptedException, IOException
{
                     log.debug("manageSessions() Registered new session: " + newSessionInfo);
                 }
             } else {
-                // Open one new session if there are no idle sessions
-                if (idleSessions == 0) {
-                    log.debug("manageSessions() There are " + numSessions + " sessions in
the pool but none of them are idle sessions, creating...");
+                // If we exceeded our session pool size, look for `idle` sessions we can
shut down
+                //  Two scenarios: we have no elastic pool sizing, in which case definitely
look for candidates
+                //  Or, we do have elastic pool sizing, in which case we need to make sure
we are above our max
+                //      pool size
+                if(idleSessions > 0 && numSessions > sessionPoolSize &&
(!elasticSessionPool || numSessions > maxSessionPoolSize)) {
 
 Review comment:
   How about use `idleSessionInfo.size()` instead of `idleSessions` int value?
   ```java
   int idleSessions = idleSessionInfo.size();
    if(idleSessions > 0 && numSessions > sessionPoolSize && (!elasticSessionPool
|| numSessions > maxSessionPoolSize)) {
                       int sessionID = idleSessionInfo.keySet().stream().findFirst().get();
   ...
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message