GithubHelp home page GithubHelp logo

Failover issue. about memcached-java-client HOT 12 CLOSED

gwhalin avatar gwhalin commented on June 14, 2024
Failover issue.

from memcached-java-client.

Comments (12)

mengli avatar mengli commented on June 14, 2024

Hi bhargavmist,

Don't use the following api:

pool.setMaintSleep
pool.setSocketTO
pool.setSocketConnectTO
pool.setMaxIdle
pool.setAliveCheck

Most of them are not implemented in 2.6.1. We keep them there because we want to make 2.6.1 compatible with previous version.

You can use our client like this:

SchoonerSockIOPool pool = SchoonerSockIOPool.getInstance("test", AuthInfo.typical("cacheuser", "123456"));
pool.setServers(serverlist);

pool.setInitConn(1);
pool.setMaxConn(1);
pool.setNagle(false);
pool.setFailback(true);
pool.setFailover(true);
pool.initialize();

And I have tried it in my PC, it works very well.

Please check out the latest source code and have a try!

Meng Lee

from memcached-java-client.

bhargavmist avatar bhargavmist commented on June 14, 2024

Hi mengli,

Thanks, I will give it a try and will update.

thanks.

from memcached-java-client.

bhargavmist avatar bhargavmist commented on June 14, 2024

Hi mengli,

I downloaded the code from the link https://github.com/gwhalin/Memcached-Java-Client/tree/performance and generated a new jar.

when i am using the new code I get

java.lang.OutOfMemoryError
at java.nio.DirectByteBuffer.(DirectByteBuffer.java:126)

error.

Following is my code:

SchoonerSockIOPool pool = null;

    try {
        pool = SchoonerSockIOPool.getInstance("test", AuthInfo.typical("cacheuser", "password"));
        pool.setServers(serverlist);

        pool.setInitConn(10);
        pool.setMinConn(5);
        pool.setMaxConn(250);
        pool.setNagle(false);
        pool.setSocketTO( 3000 );
        pool.setSocketConnectTO( 0 );
        pool.setMaxIdle( 1000 * 60 * 60 * 6 );

        pool.setFailback(true);
        pool.setFailover(true);

        pool.initialize();

        mcc = new MemCachedClient("test", true, true);

    } catch (Exception e) {
        System.out.println("Exception while initializing the pool : " + e.getMessage());

    }

Following is the full stack trace:

java.lang.OutOfMemoryError
at java.nio.DirectByteBuffer.(DirectByteBuffer.java:126)
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:72)
at com.schooner.MemCached.SchoonerSockIOPool$TCPSockIO.(SchoonerSockIOPool.java:1364)
at com.schooner.MemCached.SchoonerSockIOFactory.createSocket(SchoonerSockIOFactory.java:76)
at com.schooner.MemCached.AuthSchoonerSockIOFactory.makeObject(AuthSchoonerSockIOFactory.java:45)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1148)
at com.schooner.MemCached.SchoonerSockIOPool.getConnection(SchoonerSockIOPool.java:547)
at com.schooner.MemCached.SchoonerSockIOPool.getSock(SchoonerSockIOPool.java:485)
at com.schooner.MemCached.BinaryClient.set(BinaryClient.java:368)
at com.schooner.MemCached.BinaryClient.add(BinaryClient.java:256)
at com.danga.MemCached.MemCachedClient.add(MemCachedClient.java:709)
at com.qpass.usersecurity.memcacheD.JavaMemcacheDClient.add(JavaMemcacheDClient.java:84)
at com.qpass.usersecurity.memcacheD.JavaMemcacheDClientTest.singleTest(JavaMemcacheDClientTest.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:21)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:194)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:53)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:185)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:142)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:592)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)

It was working fine with the 2.6.1 release.

Can you pls help.

Thanks.

from memcached-java-client.

mengli avatar mengli commented on June 14, 2024

Hi bhargavmist,

I find you set the max connection number to 250. Since we will allocate about 1M buffer for each connection, you should set the heap size of JVM to more than 250M.

So you can add some configure option to your JVM, eg.
java -Xmx512m -Xms 512m

-Xmx512m sets the max size of JVM heap to 512M.

Meng Lee

from memcached-java-client.

bhargavmist avatar bhargavmist commented on June 14, 2024

Hi mengli,

Yes I changed the setMaxConn(5) to 5, my JVM is already set to Xmx1500m but I am still seeing the same error.

I also restarted my linux box.

Your help is highly appreciated.

Thanks.

from memcached-java-client.

mengli avatar mengli commented on June 14, 2024

Hi bhargavmist,

I will take a look ASAP.

Meng Li

from memcached-java-client.

bhargavmist avatar bhargavmist commented on June 14, 2024

Thanks mengli, waiting for your response.

On Tue, Jul 26, 2011 at 6:52 PM, mengli <
[email protected]>wrote:

Hi bhargavmist,

I will take a look ASAP.

Meng Li

Reply to this email directly or view it on GitHub:

#23 (comment)

from memcached-java-client.

mengli avatar mengli commented on June 14, 2024

Hi bhargavmist,

I have fixed the bug. But right now I can't submit the source code. You just need to make a few change to SchoonerSockIOPool.java, I have sent another email to tell you how to do it.

I will check in the source code later.

Meng Li

from memcached-java-client.

bhargavmist avatar bhargavmist commented on June 14, 2024

Thank you mengli, I got the email.

Thanks.

On Wednesday, July 27, 2011, mengli
[email protected]
wrote:

Hi bhargavmist,

I have fixed the bug. But right now I can't submit the source code. You just need to make a few change to SchoonerSockIOPool.java, I have sent another email to tell you how to do it.

I will check in the source code later.

Meng Li

Reply to this email directly or view it on GitHub:
#23 (comment)

from memcached-java-client.

bhargavmist avatar bhargavmist commented on June 14, 2024

Hi mengli,

Will you be releasing this bug fix version as 2.6.2?

Thanks.

On Wednesday, July 27, 2011, Bhargav Mistry [email protected] wrote:

Thank you mengli, I got the email.

Thanks.

On Wednesday, July 27, 2011, mengli
[email protected]
wrote:

Hi bhargavmist,

I have fixed the bug. But right now I can't submit the source code. You just need to make a few change to SchoonerSockIOPool.java, I have sent another email to tell you how to do it.

I will check in the source code later.

Meng Li

Reply to this email directly or view it on GitHub:
#23 (comment)

from memcached-java-client.

mengli avatar mengli commented on June 14, 2024

Hi bhargavmist,

Yes, next release 2.6.2 will be a bug fix version and will come very soon.

Meng Li

from memcached-java-client.

bhargavmist avatar bhargavmist commented on June 14, 2024

Oh ok, thank you mengli.

On Wednesday, July 27, 2011, mengli
[email protected]
wrote:

Hi  bhargavmist,

Yes, next release 2.6.2 will be a bug fix version and will come very soon.

Meng Li

Reply to this email directly or view it on GitHub:
#23 (comment)

from memcached-java-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.