模拟大并发访问量请求程序(压力测试)

import java.io.InputStream;
import java.net.URL;
 
 
public class TestURL
{
    public static void main(String[] args) throws Exception
    {
      long a = System.currentTimeMillis();
      System.out.println("Starting request url:");
      InputStream is = null;
        for(int i = 0; i < 100; i++){//此处的值可以根据需求增加
          URL url = new URL("http://qixiaorui.blog.chinajavaworld.com/entry/847/0/");//此处填写供测试的url
          is = url.openStream();
          System.out.println("Starting request url:"+i);
        }
        System.out.println("request url end.take "+(System.currentTimeMillis()-a)+"ms");
        is.close();
    }
}

 

你可能感兴趣的:(模拟大并发访问量请求程序(压力测试))