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
CSC307 Lecture 08
javiergs
PRO
0
670
Vibe Coding - AI 驅動的軟體開發
mickyp100
0
170
Spinner 軸ズレ現象を調べたらレンダリング深淵に飲まれた #レバテックMeetup
bengo4com
1
230
Apache Iceberg V3 and migration to V3
tomtanaka
0
160
AI時代の認知負荷との向き合い方
optfit
0
160
AI時代のキャリアプラン「技術の引力」からの脱出と「問い」へのいざない / tech-gravity
minodriven
21
7.2k
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
200
Oxlintはいいぞ
yug1224
5
1.3k
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
ThorVG Viewer In VS Code
nors
0
770
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
Featured
See All Featured
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
180
Become a Pro
speakerdeck
PRO
31
5.8k
Money Talks: Using Revenue to Get Sh*t Done
nikkihalliwell
0
150
How to Talk to Developers About Accessibility
jct
2
130
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.3k
Music & Morning Musume
bryan
47
7.1k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Testing 201, or: Great Expectations
jmmastey
46
8k
The SEO Collaboration Effect
kristinabergwall1
0
350
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3k
Navigating Weather and Climate Data
rabernat
0
100
Believing is Seeing
oripsolob
1
54
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