Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release_2_2_thrift_tweaks' into release_2_2_loadtest
Browse files Browse the repository at this point in the history
Conflicts:
	src/main/scala/net/lag/kestrel/Kestrel.scala
  • Loading branch information
Stephan Zuercher committed Apr 9, 2012
2 parents ff27aac + dff97ca commit 912d55c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/main/scala/net/lag/kestrel/Kestrel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Kestrel(defaultQueueConfig: QueueConfig, builders: List[QueueBuilder],
listenAddress: String, memcacheListenPort: Option[Int], textListenPort: Option[Int],
thriftListenPort: Option[Int], queuePath: String,
expirationTimerFrequency: Option[Duration], clientTimeout: Option[Duration],
maxOpenTransactions: Int)
maxOpenTransactions: Int, connectionBacklog: Option[Int])
extends Service {
private val log = Logger.get(getClass.getName)

Expand Down Expand Up @@ -73,8 +73,7 @@ class Kestrel(defaultQueueConfig: QueueConfig, builders: List[QueueBuilder],
.name(name)
.reportTo(new OstrichStatsReceiver)
.bindTo(address)
.backlog(1024)

connectionBacklog.foreach { backlog => builder = builder.backlog(backlog) }
clientTimeout.foreach { timeout => builder = builder.readTimeout(timeout) }
// calling build() is equivalent to calling start() in finagle.
builder.build(factory)
Expand All @@ -90,6 +89,7 @@ class Kestrel(defaultQueueConfig: QueueConfig, builders: List[QueueBuilder],
.name(name)
.reportTo(new OstrichStatsReceiver)
.bindTo(address)
connectionBacklog.foreach { backlog => builder = builder.backlog(backlog) }
clientTimeout.foreach { timeout => builder = builder.readTimeout(timeout) }
// calling build() is equivalent to calling start() in finagle.
builder.build(connection => {
Expand All @@ -109,9 +109,9 @@ class Kestrel(defaultQueueConfig: QueueConfig, builders: List[QueueBuilder],

def start() {
log.info("Kestrel config: listenAddress=%s memcachePort=%s textPort=%s queuePath=%s " +
"expirationTimerFrequency=%s clientTimeout=%s maxOpenTransactions=%d",
"expirationTimerFrequency=%s clientTimeout=%s maxOpenTransactions=%d connectionBacklog=%s",
listenAddress, memcacheListenPort, textListenPort, queuePath,
expirationTimerFrequency, clientTimeout, maxOpenTransactions)
expirationTimerFrequency, clientTimeout, maxOpenTransactions, connectionBacklog)

// this means no timeout will be at better granularity than 100 ms.
timer = new HashedWheelTimer(100, TimeUnit.MILLISECONDS)
Expand Down
7 changes: 6 additions & 1 deletion src/main/scala/net/lag/kestrel/config/KestrelConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,15 @@ trait KestrelConfig extends ServerConfig[Kestrel] {
*/
var maxOpenTransactions: Int = 1

/**
* An optional size for the backlog of connecting clients. This setting is applied to each listening port.
*/
var connectionBacklog: Option[Int] = Some(1000)

def apply(runtime: RuntimeEnvironment) = {
new Kestrel(
default(), queues, listenAddress, memcacheListenPort, textListenPort, thriftListenPort,
queuePath, expirationTimerFrequency, clientTimeout, maxOpenTransactions
queuePath, expirationTimerFrequency, clientTimeout, maxOpenTransactions, connectionBacklog
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/scala/net/lag/kestrel/ServerSpec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class ServerSpec extends Specification with TempFolder with TestLogging {
maxAge = 1800.seconds
}
kestrel = new Kestrel(defaultConfig, List(weatherUpdatesConfig), "localhost",
Some(PORT), None, None, canonicalFolderName, None, None, 1)
Some(PORT), None, None, canonicalFolderName, None, None, 1, None)
kestrel.start()
}

Expand Down

0 comments on commit 912d55c

Please sign in to comment.