目前我做的是一个网站统计模块   具体的技术实现是
   1 使用JS做来捕获网站的点击率
   2 在页面中嵌入该JS代码。
   3 JS将页面的请求派发给一个servlet请求对像 , 由该Servlet对像来对请求做出响应
   4 servlet将页面请求中的数据存入缓存中
   5 一个定时任务将在每隔一断时间后将缓存中的数据存入数据库中,再实现清缓存的功能(没有做同步)
   
我不知道这样做是否合理: 现在最重要的一个问题是:
   我现在做了一个压力测试, 1 每隔十毫秒请求一次 。 2 同时打开十个这样的测试页面
   现在问题出来了: 请求被阻塞了!!   请教各位大侠: 小弟这样做是否有哪个环节出错了?      
   

解决方案 »

  1.   

    问题应该不是说的阻塞,而是你的浏览器出现假死,被你误认为是阻塞,是因为你的ajax对象和ie缓存没有处理好,因为你在频繁的创造对象ajax对象,而没有进行对象清理 造成IE出现假死现象记点击数,如果你的ajax对象缓存处理不好的话,为何不在展现页面的时候更新数据库,在取数据展现页面的时候顺便更新数据库或者你用IE内部没有公开的函数去清理IE缓存。 在压力测试的环境下,JavaScript所造成的IE假死会经常出现,如果你处理不好的话
      

  2.   

    我的测试过程是在我本机测试的!!
    测试浏览器是 Firefox:
    使用的一个js函数 
    <script language="JavaScript">
    setInterval("recordSoft(2,12700,3,1)",10);
    </script>
    每隔十毫秒向服务器发一次请求:并且同时打开十个页面:
    请问下这个测试方法是否有问题!
      

  3.   

    ajax我不是很熟,不过我可以发一个段js代吗给你:
    document.write('<div style="display:none"><img id="pv_img" width="1" height="1" /></div>');function web(){
    this.ip;                           
      this.url=window.location;                         
      this.source=0;                      
      this.action=0;                      
      this.resId;                 
      this.resType=0;
      this.page="http://192.168.1.112/count/count/webFilter.jsp";  
    }function soft(){
    this.ip;                           
      this.url=window.location; 
      this.userId=0;                        
      this.source=0;                      
      this.action=0;                      
      this.resId;                 
      this.resType=0; 
      this.page="http://192.168.1.112/count/count/softFilter.jsp";              
    }function getWebUrl(record){
    var sUrl = record.page+"?a=1"; 
    sUrl += "&url="+record.url;
    sUrl += "&source="+record.source;
    sUrl += "&action="+record.action;
    sUrl += "&resId="+record.resId;
    sUrl += "&resType="+record.resType;
    return unescape(sUrl);
    }function getSoftUrl(record){


    var sUrl = record.page+"?a=1"; 
    sUrl += "&url="+record.url;
    sUrl += "&source="+record.source;
    sUrl += "&action="+record.action;
    sUrl += "&resId="+record.resId;
    sUrl += "&resType="+record.resType;
    return unescape(sUrl);
    }function recordWeb(action,resId,resType,source){
    //alert('--');
    var record = new web();
    record.source=source;
    record.action=action;
    record.resId=resId;
    record.resType=resType;
    //alert(getWebUrl(record));
    document.getElementById("pv_img").src=getWebUrl(record);
    }function recordSoft(action,resId,resType,source){
    //alert('--');
    var record = new soft();
    record.source=source;
    record.action=action;
    record.resId=resId;
    record.resType=resType;
    //alert(getSoftUrl(record));
    document.getElementById("pv_img").src=getSoftUrl(record);
    }
    function test(){
    //document.getElementById("pv_img").src = "http://192.168.1.104/72xuanCount/count/test.jsp";
    }我测试调用的页面代码如下:
    <script language="JavaScript">
    setInterval("recordSoft(2,12700,3,1)",10);
    </script>我对AJAX不太熟悉! 请你看下我这样测试的话会不会有问题?