Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Performance testing with Multi-Mechanize
Search
Rich Leland
February 07, 2012
Programming
1
400
Performance testing with Multi-Mechanize
Presentation to DC Python on Feb 7, 2012 about Multi-Mechanize, a performance testing framework.
Rich Leland
February 07, 2012
Tweet
Share
Other Decks in Programming
See All in Programming
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.1k
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
680
360° Signals in Angular: Signal Forms with SignalStore & Resources @ngLondon 01/2026
manfredsteyer
PRO
0
120
CSC307 Lecture 02
javiergs
PRO
1
780
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6k
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
CSC307 Lecture 07
javiergs
PRO
0
550
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
登壇資料を作る時に意識していること #登壇資料_findy
konifar
4
1k
Data-Centric Kaggle
isax1015
2
770
Fragmented Architectures
denyspoltorak
0
150
今こそ知るべき耐量子計算機暗号(PQC)入門 / PQC: What You Need to Know Now
mackey0225
3
370
Featured
See All Featured
The Invisible Side of Design
smashingmag
302
51k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
750
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.2k
RailsConf 2023
tenderlove
30
1.3k
Facilitating Awesome Meetings
lara
57
6.8k
How to make the Groovebox
asonas
2
1.9k
Build your cross-platform service in a week with App Engine
jlugia
234
18k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.1k
30 Presentation Tips
portentint
PRO
1
210
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
180
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2k
Transcript
Rich Leland DC Python - February 7, 2012 PERFORMANCE TESTING
WITH
WHAT IS MULTI-MECHANIZE?
WHAT IS PERFORMANCE TESTING?
UNDERSTAND AND DEFINE YOUR GOALS
WRITE TESTS, RUN. RINSE & REPEAT.
None
OBLIGATORY BILL MURRAY PHOTO
NOW WHAT?
None
USE THEM ALL
WHY USE MULTI-MECHANIZE?
IT’S PYTHON OH, AND IT CAN TEST MORE THAN JUST
WEBS
PAGES
FORMS
APIs
DATABASES
CACHE
ANYTHING YOU CAN WRITE USING PYTHON
HOW DO I USE IT?
pip install multi-mechanize
multimech-newproject <myproject>
myproject ├── test_scripts │ └── example.py └── config.cfg multimech-newproject myproject
[global] run_time: 30 rampup: 0 results_ts_interval: 10 progress_bar: on console_logging:
off xml_report: off [user_group-1] threads: 3 script: example.py [user_group-2] threads: 3 script: example.py
import requests import time class Transaction(object): def run(self): start =
time.time() url = 'http://www.treehugger.com/' r = requests.get(url) latency = time.time() - start self.custom_timers['Home_Page'] = latency time.sleep(1)
multimech-run <myproject>
$ multimech-run . user_groups: 2 threads: 20 [================100%==================] 60s/60s transactions:
232 timers: 464 errors: 0 waiting for all requests to finish... analyzing results... created results/results_2012.02.06_23.11.01/results.html done.
RESULTS
myproject ├── results │ ├── results_2012.02.05_00.16.23 │ │ ├── config.cfg
│ │ ├── results.csv │ │ └── results.html │ └── static ├── test_scripts └── config.cfg Results output
None
None
AIGHT, COOL. HOW ABOUT SOME OTHER EXAMPLES?
import requests import time class Transaction(object): def run(self): start =
time.time() url = 'http://example.com/api/v1/articles/' r = requests.get(url) latency = time.time() - start self.custom_timers['API_Articles'] = latency time.sleep(1)
import time from sqlalchemy import create_engine class Transaction(object): def __init__(self):
self.custom_timers = {} conn_info = 'postgresql+psycopg2://rleland@localhost/th' self.engine = create_engine(conn_info) def run(self): start = time.time() self.engine.execute("SELECT COUNT(*) FROM cms_entry") latency = time.time() - start self.custom_timers['Entries_Count'] = latency
import memcache import random import time NODES = ['192.168.10.2:11211',] DATA_SIZE
= 30000 WAIT_TIME = .1 KEY_RANGE = (1, 1000000) class Transaction(object): def __init__(self): self.mc = memcache.Client(NODES) self.custom_timers = {} def run(self): key = str(random.randint(*KEY_RANGE)) data = '*' * DATA_SIZE start_timer = time.time() self.mc.set(key, data) stop_timer = time.time() self.custom_timers['SET'] = stop_timer - start_timer start_timer = time.time() self.mc.get(key) stop_timer = time.time() self.custom_timers['GET'] = stop_timer - start_timer time.sleep(WAIT_TIME)
None
SET GOALS WRITE TESTS RUN TESTS ANALYZE RESPOND REPEAT
THANK YOU
Docs http://testutils.org/multi-mechanize/ Code http://github.com/cgoldberg/multi-mechanize Twitter @multimechanize IRC #multimech NOW GO
GET YOU SOME