Skip to content

Commit

Permalink
finagle-mux: remove ref-counting control toggle
Browse files Browse the repository at this point in the history
Summary: Problem / Solution

The ref-counting control toggle has been at 100% for over
two months so it's safe to assume that it's ready to be
the exclusive option.

JIRA Issues: CSL-5033

Differential Revision: https://phabricator.twitter.biz/D80225
  • Loading branch information
Daniel Schobel authored and jenkins committed Aug 14, 2017
1 parent 7610016 commit f432bd4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 51 deletions.
10 changes: 6 additions & 4 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ New Features
* finagle-init: Introduce a module to support service-loading initialization
code. ``PHAB_ID=D75950``

* finagle-mux: Default to new more efficient decoder. ``PHAB_ID=D80225``

* finagle-mysql: `IsolationLevel` support was added with
`Transactions.transactionWithIsolation` method, so the default level can be overridden
at the transaction level. ``PHAB_ID=D68944``

* finagle-mysql: Add support for unsigned integers. When enabled, unsigned integers that do
not fit into the existing signed representation are widened. For example an unsigned
Int32 is represented as a Java Long, etc. Because this changes the `c.t.f.mysql.Value`
Expand All @@ -58,10 +64,6 @@ New Features
* finagle-netty4: `KeyCredentials.CertKeyAndChain` is now available to use with
`Netty4ServerEngineFactory`. ``PHAB_ID=D80494``

* finagle-mysql: `IsolationLevel` support was added with
`Transactions.transactionWithIsolation` method, so the default level can be overridden
at the transaction level. ``PHAB_ID=D68944``

* finagle-stats: Metrics now report verbosity levels via `MetricsView.verbosity`.
``PHAB_ID=D78150``

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"toggles": [
{
"id": "com.twitter.finagle.mux.RefCountControlMessages",
"description": "Use a ref-counting control plane as the transport implementation.",
"fraction": 0.0
},
{
"id": "com.twitter.finagle.mux.TlsHeaders",
"description": "Initiate sending tls headers.",
Expand Down
19 changes: 1 addition & 18 deletions finagle-mux/src/main/scala/com/twitter/finagle/Mux.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,10 @@ object Mux extends Client[mux.Request, mux.Response] with Server[mux.Request, mu
}

object MuxImpl {
private val RefCountToggleId: String = "com.twitter.finagle.mux.RefCountControlMessages"
private val TlsHeadersToggleId: String = "com.twitter.finagle.mux.TlsHeaders"
private val refCountControlToggle: Toggle[Int] = Toggles(RefCountToggleId)
private val tlsHeadersToggle: Toggle[Int] = Toggles(TlsHeadersToggleId)
private def refCountControl: Boolean = refCountControlToggle(ServerInfo().id.hashCode)
private[Mux] def tlsHeaders: Boolean = tlsHeadersToggle(ServerInfo().id.hashCode)

/**
* A [[MuxImpl]] that uses netty4 as the underlying I/O multiplexer.
*
* @note this is experimental and not yet tested in production.
*/
val Netty4 = MuxImpl(
params => Netty4Transporter.raw(CopyingFramer, _, params),
params => Netty4Listener(CopyingFramer, params)
)

/**
* A [[MuxImpl]] that uses netty4 as the underlying I/O multiplexer and
* ref-counts inbound mux control messages. No application changes are
Expand Down Expand Up @@ -121,11 +108,7 @@ object Mux extends Client[mux.Request, mux.Response] with Server[mux.Request, mu
params => Netty4Listener(CopyingFramer, params)
)

implicit val param = Stack.Param(
// note that ref-counting toggle is dependent on n4 toggle.
if (refCountControl) Netty4RefCountingControl
else Netty4
)
implicit val param = Stack.Param(Netty4RefCountingControl)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@ import com.twitter.finagle.Mux
import com.twitter.finagle.Mux.param.{MaxFrameSize, MuxImpl}
import com.twitter.conversions.storage._

class Netty4EndToEndTest extends AbstractEndToEndTest {
def implName: String = "netty4"
def clientImpl() = Mux.client.configured(MuxImpl.Netty4)
def serverImpl() = Mux.server.configured(MuxImpl.Netty4)
}

class FragmentingNetty4EndToEndTest extends AbstractEndToEndTest {
def implName: String = "netty4"
def clientImpl() = Mux.client.configured(MuxImpl.Netty4).configured(MaxFrameSize(5.bytes))
def serverImpl() = Mux.server.configured(MuxImpl.Netty4).configured(MaxFrameSize(5.bytes))
}

class Netty4RefCountingControlEndToEndTest extends AbstractEndToEndTest {
def implName: String = "netty4"
def clientImpl() = Mux.client.configured(MuxImpl.Netty4RefCountingControl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,7 @@ class EndToEndTest
.name("ThriftMuxServer")
.bindTo(new InetSocketAddress(0))
.build(pfSvc)
val protoNew = ThriftMux.server
.withProtocolFactory(pf)
.serveIface(new InetSocketAddress(InetAddress.getLoopbackAddress, 0), iface)
val netty4 = ThriftMux.server
.configured(Mux.param.MuxImpl.Netty4)
.withProtocolFactory(pf)
.serveIface(new InetSocketAddress(InetAddress.getLoopbackAddress, 0), iface)

Expand All @@ -150,7 +146,7 @@ class EndToEndTest

Seq(
("ServerBuilder", builder, port(builder.boundAddress)),
("ThriftMux with Netty4", netty4, port(netty4.boundAddress))
("ThriftMux", netty4, port(netty4.boundAddress))
)
}

Expand All @@ -176,11 +172,6 @@ class EndToEndTest
.withClientId(clientId)
.withProtocolFactory(pf)
.newService(dest)
val netty4 = ThriftMux.client
.withClientId(clientId)
.withProtocolFactory(pf)
.configured(Mux.param.MuxImpl.Netty4)
.newService(dest)

def toIface(svc: Service[ThriftClientRequest, Array[Byte]]): TestService$FinagleClient =
new TestService.FinagledClient(svc, pf)
Expand All @@ -189,8 +180,7 @@ class EndToEndTest
("ThriftMux via ClientBuilder", toIface(builder), builder),
("Thrift via ClientBuilder", toIface(thriftBuilder), thriftBuilder),
("Thrift via proto", toIface(thriftProto), thriftProto),
("ThriftMux proto", toIface(newProto), newProto),
("ThriftMux with Netty4", toIface(netty4), netty4)
("ThriftMux proto", toIface(newProto), newProto)
)
}

Expand Down

0 comments on commit f432bd4

Please sign in to comment.