I do a test for concurrence of resin, and my conclusion is right? Tks for
answer.
Test the resin in the number of concurrent, even up to 5128
Test environment:
the server side: OS: I machine, 32-bit os, 3g memory, 1.8g dual-core CPU
resin:-Xmx1400m-Xss64k (set to minimum, in order to occupy as little
memory)
client: the loop to create 7000 threads, each cycle access resin100
Test results: resin console to see the number of threads in the Thread pool,
up to 5128;
Summary: If os, memory, cpu is ideal, on the resin itself, the maximum
number of concurrent 5k more than;
Problem: the error rate is high (7000 threads, each of 100 req thread pool
maximum value of 5128, the error rate of 42%; (1000 threads, each 100 req
thread pool max 388, the error rate of 15% ); In summary, it should be said
5k multiple concurrent ideal state, in real environment, it may be a few
hundred more than almost?
My test code is as follows:
public class Test1 {
public static int success = 0;
public static int fail = 0;
public static int reject = 0;
public static void main(String[] args) throws Exception {
long a = System.currentTimeMillis();
ThreadDemo[] td = new ThreadDemo[7000];
for(int i=0;i<td.length;i++){
td[i] = new ThreadDemo(i,a);
}
for(int i=0;i<td.length;i++){
td[i].start();
}
}
public static synchronized void setValue(int s,int f,int r){
success+=s;
fail+=f;
reject+=r;
}
public static class ThreadDemo extends Thread {
private int id = 0;
private long s = 0;
public ThreadDemo(int id,long s){
this.id=id;
this.s=s;
}
@Override
public void run() {
int success = 0;
int request_fail = 0;
int request_reject = 0;
URL url;
for (int i = 0; i < 100; i++) {
try {
url = new URL("http://ip:8080/Project1/test.jsp");
InputStream is = url.openStream();
byte[] b = new byte[100];
StringBuffer sb = new StringBuffer();
while(is.read(b)!=-1){
String ss = new String(b,"utf-8");
if(!"".equals(ss.trim()))
sb.append(ss.trim());
}
is.close();
success++;
} catch (ConnectException e) {
request_fail++;
}catch(SocketException ee){
request_reject++;
}catch(Exception e){
e.printStackTrace();
}
}
Test1.setValue(success,request_fail,request_reject);
System.out.println("request --" + id + "-- url end.take "
+ (System.currentTimeMillis() - s) + "ms
success="+Test1.success+" fail="+Test1.fail+"
request_reject="+Test1.reject);
}
}
}
_______________________________________________
resin-interest mailing list
[email protected]
http://maillist.caucho.com/mailman/listinfo/resin-interest