Session 问题,有经验的帮忙看看!!!
脚本在登录登出的过程中会在Tomcat里留下很多无用的session,这样一点点积累下去的话,会占用很多的内存,请问怎么才能把这些session清除掉?有没有人遇到过这种情况?下面是我的脚本(大家给看看):
er_login()
{
lr_start_transaction("01_er_connect_home");
web_url("login.jsp",
//"URL={URL}/jetspeed/login.jsp?tenant={tenancy}",
"URL={URL}/jetspeed/login.jsp",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=NORESOURCE",
LAST);
lr_end_transaction("01_er_connect_home", LR_AUTO);
lr_think_time(THINKTIME);
web_reg_save_param ("connect_session_id", "NOTFOUND=ERROR", "LB=Set-Cookie: JSESSIONID=","RB=;", LAST );
//脚本录制后跟现在的差不多,我只在这里取了一个session,因为后面的logout需要用到这个session。
lr_start_transaction("02_er_connect_login");
web_submit_data("j_security_check",
"Action={URL}/jetspeed/j_security_check",
"Method=POST",
"RecContentType=text/html",
"Referer={URL}/jetspeed",
"Snapshot=t2.inf",
"Mode=NORESOURCE",
ITEMDATA,
//"Name=j_username", "Value={tenancy}.{username}", ENDITEM,
"Name=j_username", "Value={username}", ENDITEM,
"Name=j_password", "Value=p", ENDITEM,
"Name=j_security_check", "Value=Login", ENDITEM,
LAST);
lr_end_transaction("02_er_connect_login", LR_AUTO);
lr_think_time(THINKTIME);
lr_start_transaction("03_er_connect_doc_list");
web_url("index.jsp",
"URL={URL}/jetspeed/index.jsp",
"Resource=0",
"RecContentType=text/html",
"Referer={URL}/jetspeed/",
"Snapshot=t3.inf",
"Mode=NORESOURCE",
LAST);
lr_end_transaction("03_er_connect_doc_list", LR_AUTO);
lr_think_time(THINKTIME);
return 0;
}
er_logout()
{
lr_start_transaction("46_er_logout");
web_url("logout.jsp",
"URL={URL}/jetspeed/logout.jsp?XMSessionId={connect_session_id}",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t4.inf",
"Mode=HTML",
LAST);
lr_end_transaction("46_er_logout", LR_AUTO);
lr_think_time(THINKTIME);
return 0;
} 没人给点意见么? 手动退出会自动清除session,直接关闭浏览器的话,到设置session失效时间后,自动释放session
页:
[1]