vaseems / xmemcached

Automatically exported from code.google.com/p/xmemcached
Apache License 2.0
0 stars 0 forks source link

java.util.concurrent.TimeoutException: Timed out(1000) waiting for operation #202

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
我照你们的文档用spring3配置了服务端和客户端,但在get/set数
据的时候却总是抛出java.util.concurrent.TimeoutException: Timed 
out(1000) waiting for 
operation的异常,我xmemcached和memcached都是用的最新版本
如果我在程序里直接用MemcachedClientBuilder builder = new 
XMemcachedClientBuilder( AddrUtil.getAddresses("192.168.1.24:12000 
192.168.1.88:12000"))的方式却不会报错,会是什么问题呢?怎么��
�决?

Original issue reported on code.google.com by sw5201...@gmail.com on 29 Jun 2012 at 4:56

GoogleCodeExporter commented 9 years ago
将你的xml配置贴出来,我估计是你设置了太大的连接池了

Original comment by killme2...@gmail.com on 29 Jun 2012 at 4:57

GoogleCodeExporter commented 9 years ago
<bean name="memcachedClientBuilder" 
class="net.rubyeye.xmemcached.XMemcachedClientBuilder">
        <constructor-arg>
            <list>
                <bean class="java.net.InetSocketAddress">
                    <constructor-arg>
                        <value>192.168.1.24</value>
                    </constructor-arg>
                    <constructor-arg>
                        <value>12000</value>
                    </constructor-arg>
                </bean>
                <bean class="java.net.InetSocketAddress">
                    <constructor-arg>
                        <value>192.168.1.88</value>
                    </constructor-arg>
                    <constructor-arg>
                        <value>12000</value>
                    </constructor-arg>
                </bean>
            </list>
        </constructor-arg>
        <constructor-arg>
            <list>
                <value>1</value>
                <value>2</value>
            </list>
        </constructor-arg>
        <!-- <property name="authInfoMap"> <map> <entry key-ref="server1"> <bean 
            class="net.rubyeye.xmemcached.auth.AuthInfo" factory-method="typical"> <constructor-arg 
            index="0"> <value>cacheuser</value> </constructor-arg> <constructor-arg index="1"> 
            <value>123456</value> </constructor-arg> </bean> </entry> </map> </property> -->
        <!-- nio connection pool size -->
        <property name="connectionPoolSize" value="5"></property>
        <!-- Use binary protocol,default is TextCommandFactory -->
        <property name="commandFactory">
            <bean class="net.rubyeye.xmemcached.command.TextCommandFactory"></bean>
        </property>

        <property name="sessionLocator">
            <bean class="net.rubyeye.xmemcached.impl.KetamaMemcachedSessionLocator"></bean>
        </property>
        <property name="transcoder">
            <bean class="net.rubyeye.xmemcached.transcoders.SerializingTranscoder" />
        </property>
        <property name="bufferAllocator">
            <bean class="net.rubyeye.xmemcached.buffer.SimpleBufferAllocator"></bean>
        </property>
    </bean>
    <bean name="memcachedClient" class="net.rubyeye.xmemcached.MemcachedClient" factory-bean="memcachedClientBuilder"
        factory-method="build" destroy-method="shutdown" />

对了memcached那边我用了magent做代理

Original comment by sw5201...@gmail.com on 29 Jun 2012 at 5:00

GoogleCodeExporter commented 9 years ago
<property name="connectionPoolSize" value="5"></property>
将它设置1试试,并且设置opTimeout达到3000左右,1000通常来说��
�不够的,测试还是可以。

Original comment by killme2...@gmail.com on 29 Jun 2012 at 5:08

GoogleCodeExporter commented 9 years ago
还是一样

Original comment by sw5201...@gmail.com on 29 Jun 2012 at 5:16

GoogleCodeExporter commented 9 years ago
郁闷,我重启下magent就Ok了,会是什么原因呢?

Original comment by sw5201...@gmail.com on 29 Jun 2012 at 5:21

GoogleCodeExporter commented 9 years ago
而当我尝试不同的操作时也会经常报这个错,需要重启magent

Original comment by sw5201...@gmail.com on 29 Jun 2012 at 5:26

GoogleCodeExporter commented 9 years ago
我不知道什么是magent。这个的意思是操作超时了,默认是1秒�
��时,你有设置opTImeout到3000,也就是3秒吗?

Original comment by killme2...@gmail.com on 29 Jun 2012 at 5:28

GoogleCodeExporter commented 9 years ago
设置了,设置多少都没有,magent就是个memcached的代理罗https://
code.google.com/p/memagent/

Original comment by sw5201...@gmail.com on 29 Jun 2012 at 5:35

GoogleCodeExporter commented 9 years ago
你设置成多少,我看看,怎么设置的,不可能没用的。

Original comment by killme2...@gmail.com on 29 Jun 2012 at 5:48

GoogleCodeExporter commented 9 years ago
memcachedClient.setOpTimeout(3000);

Original comment by sw5201...@gmail.com on 29 Jun 2012 at 5:58

GoogleCodeExporter commented 9 years ago
那只能说你的数据是不是太大,或者magent有没有什么问题,��
�致经常超时。可以将这个时间调长,或者直接链接memcached看�
��。

Original comment by killme2...@gmail.com on 29 Jun 2012 at 6:03

GoogleCodeExporter commented 9 years ago
确实去掉magent就没问题了,我想请问下如果不用magent,怎么��
�现memcached的负载均衡和单点故障?又或者在xmemcached里已有相
关解决方案? 

Original comment by sw5201...@gmail.com on 29 Jun 2012 at 6:19

GoogleCodeExporter commented 9 years ago
搜索memcached proxy,选择很多吧。
不过memcached的分布一般也都是在客户端做,一般都不搞proxy。
当然,代价就是缓冲命中率在故障时候下降。

Original comment by killme2...@gmail.com on 29 Jun 2012 at 6:22

GoogleCodeExporter commented 9 years ago
多谢

Original comment by sw5201...@gmail.com on 29 Jun 2012 at 8:13

GoogleCodeExporter commented 9 years ago
我改了用twitter的twemproxy做proxy,一次操作也没成功过,一直��
�是java.util.concurrent.TimeoutException,郁闷

Original comment by sw5201...@gmail.com on 29 Jun 2012 at 9:46

GoogleCodeExporter commented 9 years ago

Original comment by killme2...@gmail.com on 16 Jul 2012 at 11:49