0
finagle 응용 프로그램에서 memcached 코덱을 사용하고 있습니다. 그러나 spymemcached 클라이언트를 사용하는 것보다 성능이 매우 좋지 않습니다. 나는 spymemached가 8k req/s이고 finagle의 memcached 코덱이 10 req/s이다. memcached도 내 컴퓨터에서 실행 중입니다. 내가 놓친 게 있니? 스트레스 테스트 중에 오류의 예 :Finagle + Memcached 코덱 성능이 좋지 않음
클라이언트가 구성되는 방법Mar 05, 2014 10:22:10 AM com.twitter.finagle.builder.SourceTrackingMonitor handle
SEVERE: A server service httpserver threw an exception
com.twitter.finagle.ChannelWriteException: org.jboss.netty.channel.ConnectTimeoutException: connection timed out: localhost/127.0.0.1:11211
at com.twitter.finagle.NoStacktrace(Unknown Source)
Caused by: org.jboss.netty.channel.ConnectTimeoutException: connection timed out: localhost/127.0.0.1:11211
at org.jboss.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:137)
at org.jboss.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:83)
at org.jboss.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
at org.jboss.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
:
def client = Client(ClientBuilder()
.hosts(parseHosts())
.hostConnectionLimit(10)
.codec(Memcached())
.retries(2)
.daemon(true)
.build())
간단한 GET 작업 :
def getUserTries(username: String): Future[Int] = {
client.get(s"${username}_tries") flatMap { v => v match {
case Some(c:ChannelBuffer) => Future.value(UserCache.fromChannelBuffer(c).toInt)
case _ => Future.value(0)
}
}
그리고 일련의 작업 :
def saveUserTries(username: String, tries: Int): Future[Unit] = {
client.set(s"${username}_tries", UserCache.toChannelBuffer(tries.toString))
}