Monday, March 08, 2010

SQL load testing with JMeter

Jmeter can easily trigger SQL statement or Stored Procedure.
by configuring following items, you can send a request to DB directly:
 DB URL:jdbc:sqlserver://yourIP:port(1433 as default value);DatabaseName=Dbname  
 JDBC Driver Class: com.microsoft.sqlserver.jdbc.SQLServerDriver  
 username/password:**/**  
 note: please put "sqljdbc4.jar" to your Jmeter/lib directly  


Before running your testing against limited prepared parameters, then you may need to clean up the DB cache between 2 rounds of tests. So that the performance data can be reliable.

here is one way taken from : http://www.sql-server-performance.com/tips/dbcc_commands_p1.aspx

DBCC DROPCLEANBUFFERS: Use this command to remove all the data from SQL Server's data cache (buffer) between performance tests to ensure fair testing. Keep in mind that this command only removes clean buffers, not dirty buffers. Because of this, before running the DBCC DROPCLEANBUFFERS command, you may first want to run the CHECKPOINT command first. Running CHECKPOINT will write all dirty buffers to disk. And then when you run DBCC DROPCLEANBUFFERS, you can be assured that all data buffers are cleaned out, not just the clean ones.

Example:

DBCC DROPCLEANBUFFERS


And some of posts recommend to run following 2 commands in order to get testing readings from scratch:

DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE

So I adopted before running next round of testing:

CHECKPOINT 30
DBCC DROPCLEANBUFFERS
DBCC FREEPROCCACHE

No comments:

Post a Comment