Permalink
Browse files

finagle-netty4: Remove UsePooling toggle

Summary: We've been running with pooling enable for 1.5 months and we think it's safe to remove the
toggle now (and switch to pooling by default).

JIRA Issues: CSL-4929

Differential Revision: https://phabricator.twitter.biz/D75014
  • Loading branch information...
vkostyukov authored and jenkins committed Jul 27, 2017
1 parent 094e7bd commit a70b4b92bf025e30284d4ef96d1d3150c298ef97
View
@@ -37,6 +37,8 @@ New Features
* finagle-netty4: Adds support for passing a chain file to the default TLS implementation.
``PHAB_ID=D59531``
* finagle-netty4: Netty 4 transports now use pooled allocators by default. ``PHAB_ID=D75014``
* finagle-mysql: `IsolationLevel` support was added with
`Transactions.transactionWithIsolation` method, so the default level can be overridden
at the transaction level. ``PHAB_ID=D68944``
@@ -9,11 +9,6 @@
"id": "com.twitter.finagle.netty4.EnableReferenceLeakTracking",
"description": "Enable reference leak tracking. Exports a counter to 'finagle/netty4/reference_leaks'. Requires io.netty.leakDetectionLevel env variable >= simple. See https://netty.io/wiki/reference-counted-objects.html#wiki-h3-11",
"fraction": 0.0
},
{
"id": "com.twitter.finagle.netty4.UsePooling",
"description": "Enable pooling",
"fraction": 0.0
}
]
}
@@ -34,83 +34,79 @@ private[netty4] object exportNetty4MetricsAndRegistryEntries {
private[this] val exportMetrics = Once {
if (usePooling()) {
val metric = PooledByteBufAllocator.DEFAULT.metric()
val poolingStats = stats.scope("pooling")
val metric = PooledByteBufAllocator.DEFAULT.metric()
val poolingStats = stats.scope("pooling")
// Allocations.
// Allocations.
gauges.add(
poolingStats.addGauge("allocations", "huge")(
metric.directArenas().asScala.foldLeft(0.0f)(sumHugeAllocations)
)
gauges.add(
poolingStats.addGauge("allocations", "huge")(
metric.directArenas().asScala.foldLeft(0.0f)(sumHugeAllocations)
)
)
gauges.add(
poolingStats.addGauge("allocations", "normal")(
metric.directArenas().asScala.foldLeft(0.0f)(sumNormalAllocations)
)
gauges.add(
poolingStats.addGauge("allocations", "normal")(
metric.directArenas().asScala.foldLeft(0.0f)(sumNormalAllocations)
)
)
gauges.add(
poolingStats.addGauge("allocations", "small")(
metric.directArenas().asScala.foldLeft(0.0f)(sumSmallAllocations)
)
gauges.add(
poolingStats.addGauge("allocations", "small")(
metric.directArenas().asScala.foldLeft(0.0f)(sumSmallAllocations)
)
)
gauges.add(
poolingStats.addGauge("allocations", "tiny")(
metric.directArenas().asScala.foldLeft(0.0f)(sumTinyAllocations)
)
gauges.add(
poolingStats.addGauge("allocations", "tiny")(
metric.directArenas().asScala.foldLeft(0.0f)(sumTinyAllocations)
)
)
// Deallocations.
// Deallocations.
gauges.add(
poolingStats.addGauge("deallocations", "huge")(
metric.directArenas().asScala.foldLeft(0.0f)(sumHugeDeallocations)
)
gauges.add(
poolingStats.addGauge("deallocations", "huge")(
metric.directArenas().asScala.foldLeft(0.0f)(sumHugeDeallocations)
)
)
gauges.add(
poolingStats.addGauge("deallocations", "normal")(
metric.directArenas().asScala.foldLeft(0.0f)(sumNormalDellocations)
)
gauges.add(
poolingStats.addGauge("deallocations", "normal")(
metric.directArenas().asScala.foldLeft(0.0f)(sumNormalDellocations)
)
)
gauges.add(
poolingStats.addGauge("deallocations", "small")(
metric.directArenas().asScala.foldLeft(0.0f)(sumSmallDeallocations)
)
gauges.add(
poolingStats.addGauge("deallocations", "small")(
metric.directArenas().asScala.foldLeft(0.0f)(sumSmallDeallocations)
)
)
gauges.add(
poolingStats.addGauge("deallocations", "tiny")(
metric.directArenas().asScala.foldLeft(0.0f)(sumTinyDeallocations)
)
gauges.add(
poolingStats.addGauge("deallocations", "tiny")(
metric.directArenas().asScala.foldLeft(0.0f)(sumTinyDeallocations)
)
}
)
}
private[this] val exportRegistryEntries = Once {
if (usePooling()) {
val metric = PooledByteBufAllocator.DEFAULT.metric()
val metric = PooledByteBufAllocator.DEFAULT.metric()
GlobalRegistry.get.put(
Seq("library", "netty4", "pooling", "chunkSize"),
metric.chunkSize.toString
)
GlobalRegistry.get.put(
Seq("library", "netty4", "pooling", "chunkSize"),
metric.chunkSize.toString
)
GlobalRegistry.get.put(
Seq("library", "netty4", "pooling", "numDirectArenas"),
metric.numDirectArenas.toString
)
GlobalRegistry.get.put(
Seq("library", "netty4", "pooling", "numDirectArenas"),
metric.numDirectArenas.toString
)
GlobalRegistry.get.put(
Seq("library", "netty4", "pooling", "numHeapArenas"),
metric.numHeapArenas.toString
)
}
GlobalRegistry.get.put(
Seq("library", "netty4", "pooling", "numHeapArenas"),
metric.numHeapArenas.toString
)
GlobalRegistry.get.put(
Seq("library", "netty4", "native epoll enabled"),
@@ -1,23 +1,15 @@
package com.twitter.finagle.netty4.param
import com.twitter.finagle.netty4.{LeakDetectingAllocator, usePooling, trackReferenceLeaks}
import com.twitter.finagle.netty4.{LeakDetectingAllocator, trackReferenceLeaks}
import com.twitter.finagle.Stack
import io.netty.buffer.{ByteBufAllocator, PooledByteBufAllocator, UnpooledByteBufAllocator}
import io.netty.buffer.{ByteBufAllocator, PooledByteBufAllocator}
private[netty4] case class Allocator(allocator: ByteBufAllocator)
private[netty4] object Allocator {
// nb: we can't use io.netty.buffer.UnpooledByteBufAllocator.DEFAULT
// because we don't prefer direct byte buffers.
//
// See CSL-3027 for more details.
val Unpooled =
if (trackReferenceLeaks.enabled) LeakDetectingAllocator
else new UnpooledByteBufAllocator( /* preferDirect */ false, /* disableLeakDetector */ true)
implicit val allocatorParam: Stack.Param[Allocator] = Stack.Param(
Allocator(
if (usePooling()) PooledByteBufAllocator.DEFAULT else Unpooled
if (trackReferenceLeaks.enabled) LeakDetectingAllocator
else PooledByteBufAllocator.DEFAULT
)
)
}

This file was deleted.

Oops, something went wrong.

0 comments on commit a70b4b9

Please sign in to comment.