Comments (13)
thanks a lot for reporting the issues. could you list step by step how did you produce the problem?
from memcached-java-client.
Thanks happybyron.
My test steps is like this:
1)copy TestMemcachedSet.jar and memcached-client2.5.1.jar to JMeter_home/lib/ext/ ;
2)Create a JAVA Request JMeter Sampler,select TestMemcachedSet to run .
Jmeter's manual :http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Java_Request
But,when I used memcached-client 2.0.1, it runs well.
from memcached-java-client.
hi weiqian, I've done same thing as you said. But how can I get the result? There is no response when I click run->start
from memcached-java-client.
You can new some listeners under Test Plan for Graph Results, for example: Aggregate Report,View Results Tree.
The manual url: http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Graph_Results
from memcached-java-client.
Hi Yang:
try to copy all the resources jar file in memcached client and your project into %JMETER_HOME%/lib and then give a try.
from memcached-java-client.
hi happybyron:
I have tried it,but the same NullPointerException occurred when more than 100 threads runing every 1 second.And there was a new error like below when more than 100 threads :
com.schooner.MemCached.SchoonerSockIOPool Thu Jun 24 09:37:34 CST 2010 - ++++ fa
iled to get SockIO obj for: 172.20.67.105:11211
Any ideas can help me solve the problem ?
from memcached-java-client.
I think this error is caused by TIME_WAIT status during TCP connection closing.
Run "netstat -an|grep 11211" on your server to check if I'm right.
If I'm right, try sudo sysctl -w net.ipv4.tcp_tw_recycle=1.
from memcached-java-client.
I found the error is caused by your code not memcached client. The initialize() and shutdown() of pool should not be called in each thread. They should only be called once. The java.lang.NullPointerException happens when some thread try get connection from pool after another thread has shutdown the pool.
BTW: SampleResult results should not be shared with all threads, please see jmeter.log for the error info.
Please refer my code for more info:
package com.schooner.MemCached;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.jmeter.config.Arguments;
import org.apache.jmeter.protocol.java.sampler.AbstractJavaSamplerClient;
import org.apache.jmeter.protocol.java.sampler.JavaSamplerContext;
import org.apache.jmeter.samplers.SampleResult;
import com.danga.MemCached.MemCachedClient;
import com.danga.MemCached.SockIOPool;
public class JmetTest extends AbstractJavaSamplerClient{
private String key;
private String value;
private static SockIOPool pool = null;
private static AtomicInteger flag = new AtomicInteger();
static MemCachedClient mc;
private String serverlist;
private static int timeout;
public void setupTest(JavaSamplerContext arg0) {
timeout = arg0.getIntParameter("timeout");
key = arg0.getParameter("key");
value = arg0.getParameter("value");
serverlist = arg0.getParameter("serverlist");
if(flag.get() == 0) {
init();
}
}
synchronized private void init(){
System.out.println(serverlist + " " + key + " " + value);
pool = SockIOPool.getInstance();
pool.setServers(serverlist.split(","));
// Integer[] weights={1,2};
// pool.setWeights(weights);
// pool.setNagle( false );
pool.setSocketTO(timeout );
// pool.setHashingAlg(2);
pool.setMaxConn(100);
pool.initialize();
mc = new MemCachedClient();
// mc.setPrimitiveAsString(true);
// mc.setSanitizeKeys(false);
flag.set(1);
}
public Arguments getDefaultParameters() {
Arguments params = new Arguments();
params.addArgument("serverlist", "172.16.11.40:11211");
params.addArgument("timeout", "5000");
params.addArgument("key", "key");
params.addArgument("value", "value");
return params;
}
public SampleResult runTest(JavaSamplerContext arg0) {
SampleResult results = new SampleResult();
results.setSampleLabel("memcached" );
boolean result=false;
try{
results.sampleStart();
result = mc.set(key,value);
results.setSuccessful(result);
}catch(Exception e){
e.printStackTrace();
results.setSuccessful(result);
}finally {
// Record end time and populate the results.
results.sampleEnd();
}
return results;
}
public void teardownTest(JavaSamplerContext arg0) {
}
}
from memcached-java-client.
I can't find any function to write pool.shutdown() ... I think jmeter is not suitable to test app with connection pools.. If you want use it, you'd better modify its source code.
from memcached-java-client.
Thanks very much for xuhuleon's reply.
May Be your are right, I will try other method to test .
But I have another question, if it cansed by Jmeter tool, why java-memcached-2.0.1client can run well when more then 100 theads.
from memcached-java-client.
I have tried your code in 2.0.1, but the same error happened...
from memcached-java-client.
Thanks very much. I will try other ways for memcached's concurrent test .
from memcached-java-client.
Thanks, Weiqin.
from memcached-java-client.
Related Issues (20)
- Issue number 35 not fixed properly HOT 1
- Binary and Ascii clients together in one application
- 2.6.3 version:java.lang.OutOfMemoryError: Direct buffer memory
- Update code from maven (versions 3.*)
- Memcached信息过期的问题 HOT 1
- the return value of statsCacheDump() in BinaryClient
- why we dont have getExpiryTime(key) method?
- The flush_all method is working on the wrong way
- Add a license to the repo HOT 1
- nio下超时问题
- when ClassNotFoundException is thrown , a memory leak will happen after many times of get() operation.
- how to confirm a key exit and not to deserialization it
- Memcached client throwing NullPointerException
- java.lang.VerifyError: Bad type on operand stack
- Does this client support auth with password?
- java.io.IOException: Connection timed out HOT 1
- exception thrown while writing bytes to server on set HOT 1
- Memcache Client returns null even when cache is hit.
- Memcached self maintenance
- Cache client not honoring Expiry
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from memcached-java-client.