January 29, 2009

Pylot Testimonial - Easy Setup for Web Load Testing

(Pylot is a an open source web performance/load testing tool I developed)

I just saw this post from Mark (f4nt) about load/performance testing Confluence (enterprise Wiki software). He briefly talks about performance tool selection and why he chose Pylot as his tool.

Load Testing Confluence

"A small part of my problem of getting my tests rolling was finding a test suite that suited my needs. There’s a ton of potential options such Grinder, Bench, Browsermob, WebInject, HttPerf, funkload, and so on and so forth. I do want to use BrowserMob, just because it’s incredibly slick, looks easy to use, and looks to be quite reliable. Unfortunately, it’s not free though, and my budget for this testing is currently $0 :). My big problem with a few of the load testing applications is that they were a major pain just to setup, and get rolling. JMeter kept crashing, and was more effort to setup than I wanted to deal with. Grinder, again, didn’t seem to have an easy setup method. Granted, I could have made either of these work, and it wouldn’t have killed me. The fact of the matter was though that I just don’t have time to deal with these items. While I am doing these tests for work, I’m mainly doing them off hours because that’s when I have time to actually do it. Hence, I wanted something that could give me basic statistics, that I could setup quickly, that was free. Considering my slant towards open source software and python, the application I would use being written in Python and being GPLed were bonuses.

That brings us to Pylot. It’s free, it’s released under the GPL, and it’s written in Python. As a bonus, the tests are simple to setup, the result output is usable, and making modifications to the application was easy as well. This allows me to quickly create test scenarios and pound away at the application I’m testing with little to no fuss whatsoever. Creating tests is just a matter of modifying a simple XML to place the URLs you wish to hit. You can have post requests as well without any major trouble. Whatever it is you want to do, seems to be quite plausible in the grand scheme of things. Then, when you run into something you can’t do, modifying the code itself to make it do what you want isn’t hard at all either."

Thanks for using and giving props to Pylot, Mark!

January 15, 2009

Python - Read Outlook Email and Save Embedded Attachments

I was struggling with this for days, so I figured I should post the code so others can see how to do it.

The following script will read the last email in an Outlook mailbox and save the attachments. It uses the CDO COM Interface to interact with Outlook/Exchange.

#!/usr/bin/env python
# Read the last email in an Outlook mailbox and save the attachments.

from win32com.client import Dispatch


def main():   
    session = Dispatch('MAPI.session')
    #session.Logon('Outlook')  # for local mailbox
    session.Logon('','',0,1,0,0,'exchange.foo.com\nusername');
    inbox = session.Inbox
    message = inbox.Messages.GetLast()
    attachments = message.Attachments
    for i in range(attachments.Count):
        attachment = attachments.Item(i + 1) # indexes are 1 based
        filename = 'c:\\tempfile_%i' % i
        attachment.WriteToFile(filename)
    session.Logoff()


if __name__ == '__main__':
    main()

* Extra Special thanks to Sergey Golovchenko for helping out.

January 9, 2009

Capacity Planning - A Recession is All About Doing More With Less

I liked this quote a lot:

"A recession is all about doing more with less or, at least, with the capital equipment already purchased. That's a major reason for doing capacity planning."
(from Guerrilla Training Schedule 2009)

I never thought of a recession in those terms. But perhaps this is a boon for Performance Engineers into testing/tuning/scaling and capacity planning. [shrug] Who knows.

January 2, 2009

Weird Python 3.0 / SciTE Editor Issue - Console Output

My editor (SciTE) has always worked fine for programming Python 2.x. I'm now trying some Python 3.0 code and ran into an issue on my first script. The issue doesn't happen running the same code under 2.x. It is really confusing and annoying me and I have no idea who to file a bug with.

For whatever reason, as soon as I call an http.client request() method from within a while loop, nothing further is printed to the editor's console (stdout). If it is not in a loop, I get the output. The script executes fine aside from printing output. If I run the script from a regular command prompt (outside of SciTE), it works fine also.

Setup:
* Windows (tested on XP and Vista)
* Python 3.0 Final
* SciTE Version 1.75-wbd-1

This works: ('foo' is printed once to console)

import http.client

conn = http.client.HTTPConnection('www.goldb.org')
conn.request('GET', '/')
conn.close()
print('foo')

This works: ('foo' is printed repeatedly to console)

import http.client

while True:
    conn = http.client.HTTPConnection('www.goldb.org')
    # conn.request('GET', '/')
    conn.close()
    print('foo')

This doesn't work: (nothing is printed to console)

import http.client

while True:
    conn = http.client.HTTPConnection('www.goldb.org')
    conn.request('GET', '/')
    conn.close()
    print('foo')

This same exact setup works fine in Python 2.x. I've also tried starting Python with the '-u' option to get unbuffered output.

Anyone have ANY clue what could be going on?


Update: This seems to be related to Issue 4705 at bugs.python.org. It has to do with how Python 3.0 does (or doesn't) do unbuffered I/O. A patch was already submitted. Hope it's fixed in next release.