You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2024/03/16 00:02:27 UTC

[PR] [WIP] support jackson buffer recycler [incubator-pekko-http]

pjfanning opened a new pull request, #519:
URL: https://github.com/apache/incubator-pekko-http/pull/519

   (no comment)


-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] support jackson buffer recycler [pekko-http]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #519:
URL: https://github.com/apache/pekko-http/pull/519#discussion_r1541543557


##########
http-marshallers-java/http-jackson/src/main/java/org/apache/pekko/http/javadsl/marshallers/jackson/Jackson.java:
##########
@@ -113,7 +116,28 @@ static ObjectMapper createMapper(final Config config) {
         JsonFactory.builder()
             .streamReadConstraints(streamReadConstraints)
             .streamWriteConstraints(streamWriteConstraints)
+            .recyclerPool(getBufferRecyclerPool(config))
             .build();
     return new JsonMapper(jsonFactory);
   }
+
+  private static RecyclerPool<BufferRecycler> getBufferRecyclerPool(final Config cfg) {
+    switch (cfg.getString("buffer-recycler.pool-instance")) {

Review Comment:
   And maybe we can assert it should be null too.



-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] support jackson buffer recycler [pekko-http]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #519:
URL: https://github.com/apache/pekko-http/pull/519#discussion_r1541541664


##########
http-marshallers-java/http-jackson/src/main/java/org/apache/pekko/http/javadsl/marshallers/jackson/Jackson.java:
##########
@@ -113,7 +116,28 @@ static ObjectMapper createMapper(final Config config) {
         JsonFactory.builder()
             .streamReadConstraints(streamReadConstraints)
             .streamWriteConstraints(streamWriteConstraints)
+            .recyclerPool(getBufferRecyclerPool(config))
             .build();
     return new JsonMapper(jsonFactory);
   }
+
+  private static RecyclerPool<BufferRecycler> getBufferRecyclerPool(final Config cfg) {
+    switch (cfg.getString("buffer-recycler.pool-instance")) {

Review Comment:
   As it's been used in the exceptions, how about extract to a local val?



-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] support jackson buffer recycler [pekko-http]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning commented on code in PR #519:
URL: https://github.com/apache/pekko-http/pull/519#discussion_r1541549132


##########
http-marshallers-java/http-jackson/src/main/java/org/apache/pekko/http/javadsl/marshallers/jackson/Jackson.java:
##########
@@ -113,7 +116,28 @@ static ObjectMapper createMapper(final Config config) {
         JsonFactory.builder()
             .streamReadConstraints(streamReadConstraints)
             .streamWriteConstraints(streamWriteConstraints)
+            .recyclerPool(getBufferRecyclerPool(config))
             .build();
     return new JsonMapper(jsonFactory);
   }
+
+  private static RecyclerPool<BufferRecycler> getBufferRecyclerPool(final Config cfg) {
+    switch (cfg.getString("buffer-recycler.pool-instance")) {

Review Comment:
   it is defaulted in reference.conf - virtually every config would blow up if we didn't have defaults - nowhere do we need to check for them not being set - because we have defaults in reference.conf



-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] support jackson buffer recycler [pekko-http]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #519:
URL: https://github.com/apache/pekko-http/pull/519#discussion_r1541552588


##########
http-marshallers-java/http-jackson/src/main/java/org/apache/pekko/http/javadsl/marshallers/jackson/Jackson.java:
##########
@@ -113,7 +116,28 @@ static ObjectMapper createMapper(final Config config) {
         JsonFactory.builder()
             .streamReadConstraints(streamReadConstraints)
             .streamWriteConstraints(streamWriteConstraints)
+            .recyclerPool(getBufferRecyclerPool(config))
             .build();
     return new JsonMapper(jsonFactory);
   }
+
+  private static RecyclerPool<BufferRecycler> getBufferRecyclerPool(final Config cfg) {
+    switch (cfg.getString("buffer-recycler.pool-instance")) {
+      case "thread-local":
+        return JsonRecyclerPools.threadLocalPool();
+      case "lock-free":
+        return JsonRecyclerPools.newLockFreePool();
+      case "shared-lock-free":
+        return JsonRecyclerPools.sharedLockFreePool();
+      case "concurrent-deque":
+        return JsonRecyclerPools.newConcurrentDequePool();
+      case "shared-concurrent-deque":
+        return JsonRecyclerPools.sharedConcurrentDequePool();
+      case "bounded":
+        return JsonRecyclerPools.newBoundedPool(cfg.getInt("buffer-recycler.bounded-pool-size"));
+      default:
+        throw new IllegalArgumentException(
+            "Unknown recycler-pool: " + cfg.getString("buffer-recycler.pool-instance"));

Review Comment:
   I mean it is been used here too



-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] support jackson buffer recycler [pekko-http]

Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #519:
URL: https://github.com/apache/pekko-http/pull/519


-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org