The problem in performance test
Posted: Thu Oct 15, 2009 8:08 pm
Hi,stimulsoft.10000 records I used to do testing,Test results far from satisfactory,loaded time required 1 minute,memoy need more 400m.Open three consecutive test,iis Collapse!!!! memory uesd 1.2g! In load Test,500 records, Concurrent users less than 5!!!!! please indicate the error in the following code!thanks vert mush!
Code: Select all
static int TOP = 0;
static WebDemo() {
StiConfig.InitWeb();
StiReport.HideExceptions = false;
StiReport.HideMessages = false;
TOP = int.Parse(System.Configuration.ConfigurationManager.AppSettings["top"].ToString());
}
Stopwatch sw;
DataTable dt = new DataTable("COPTC");
DataSet ds = new DataSet("COPTC");
StiReport report;
long initDataTime = 0;
long initReport = 0;
bool isLoadFormDll=false;
///
/// ?????
///
private void InitDataSoure() {
using (SqlConnection conn = new SqlConnection("Password=111111;Persist Security Info=True;Data Source=192.168.101.135;Integrated Security=False;Initial Catalog=DEMO;User ID=sa")) {
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = @"SELECT top " + TOP.ToString() + @" COPTC.*, COPTD.*, CMSMQ.MQ001, CMSMQ.MQ002, CMSMQ.MQ034, COPMA.MA002,
COPMA.MA006, CMSMV.MV002, CMSMB.MB002, CMSME.ME002,CMSMA.MA092
FROM COPTC LEFT JOIN
COPTD ON COPTC.TC001 = COPTD.TD001 AND COPTC.TC002 = COPTD.TD002 LEFT JOIN
CMSMQ ON COPTC.TC001 = CMSMQ.MQ001 LEFT JOIN
COPMA ON COPTC.TC004 = COPMA.MA001 LEFT JOIN
CMSMV ON COPTC.TC006 = CMSMV.MV001 LEFT JOIN
CMSMB ON COPTC.TC007 = CMSMB.MB001 LEFT JOIN
CMSME ON COPTC.TC005 = CMSME.ME001,CMSMA";
cmd.CommandType = CommandType.Text;
using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) {
sda.Fill(dt);
ds.Tables.Add(dt);
}
}
}
///
/// ???????
///
private void InitReport() {
string path = Server.MapPath("");
if (File.Exists(path + "\\Report3.dll")) {
report = StiReport.GetReportFromAssembly(path + "\\Report3.dll", false);
isLoadFormDll = true;
report.RegData("COPTC", ds);
report.Render(true);
}
else {
report = new StiReport();
report.Load(path + "\\Report3.mrz");
report.Dictionary.Databases.Clear();
report.DataSources.Clear();
report.DataStore.Clear();
if (report.CompiledReport != null) report.CompiledReport.DataStore.Clear();
report.RegData("COPTC", ds);
report.Dictionary.Synchronize();
StiReport.CompileReportsToAssembly(path + "\\Report3.dll", new StiReport[] { report }, StiReportLanguageType.CSharp);
report.Render(false);
}
}
protected void Page_Load(object sender, System.EventArgs e) {
sw = Stopwatch.StartNew();
if (!IsPostBack) {
InitDataSoure();
sw.Stop();
initDataTime = sw.ElapsedMilliseconds;
sw.Start();
Session["report"] = ds;
}
else {
ds = Session["report"] as DataSet; ;
}
InitReport();
sw.Stop();
initReport = sw.ElapsedMilliseconds - initDataTime;
sw.Start();
StiWebViewer1.Report = report;
this.Unload += new EventHandler(WebDemo_Unload);
}
void WebDemo_Unload(object sender, EventArgs e) {
//?????
sw.Stop();
string path = Server.MapPath("") + "\\log.txt";
using (FileStream stream = System.IO.File.Open(path, FileMode.OpenOrCreate)) {
using (StreamWriter writer = new StreamWriter(stream)) {
stream.Position = stream.Length;
writer.WriteLine(DateTime.Now.ToString());
writer.WriteLine(Page.IsPostBack ? "??????" : "???????");
if (!Page.IsPostBack) { writer.WriteLine(isLoadFormDll ? "?????dll????" : "?????????????"); }
writer.WriteLine("Report load data time:"+initDataTime.ToString());
writer.WriteLine("Report init time:" + initReport.ToString());
writer.WriteLine("Report load time:" + sw.ElapsedMilliseconds.ToString(), EventLogEntryType.Information);
//writer.WriteLine("??????:?" + (memoryChanged / 1024).ToString("0,0") + "K,?:" + (GC.GetTotalMemory(false) / 1024).ToString("0,0") + "K");
writer.WriteLine("___________________________________");
}
}
}