Category Archives: Uncategorized

What I Learned at PyTennessee 2015

This Sunday saw the conclusion of the second annual PyTennessee conference. A few hundred people came from near and far to talk all things Python. Here are my takeaways:

1. Flask Looks Cool, But I Haven’t Needed It Yet

You could say that Django is my hammer, and I’ve treated most of my recent projects as nails. I’ve certainly been aware of Flask but haven’t dug in enough yet to know what it’s really all about. Thanks to @commadelimited‘s presentation on the subject, I get it: it’s URLs, views, and templates without all the other stuff Django provides. The sample code looks beautiful and simple, but the Django ORM is my workhorse. Check out the slides.

2. I Need to Work Harder at Being a Mentor

@jessejiryudavis gave a great talk on mentoring. What really hit home for me was that a Senior Engineer ought to be evaluated not just on their work, but their ability to power up their junior counterparts. Here’s the written version: http://emptysqua.re/blog/mentoring/

3. Yes, Virginia, Software Can Be Beautiful

Those who were present for @2braids‘ “The Well-Tempered” API presentation/performance will be talking about it for many PyTennessees to come. Three words: Baroque Cooperative Multitasking.

4. My Code Isn’t As Empathetic As It Could Be

I thought I was doing a good job translating user stories with my ‘plain english’ comments in my functional tests. Then @odonnell004 gave me a between-session version of his talk on Behavior-Driven Development. Now THAT’s user empathy. I’ll be trying to get LiveServerTestCase to do the Cucumber/Lettuce thing. Here’s his approach for doing BDD with Django.

5. I Might Be Working Too Hard On My Mocks

Nothing brings on a face-palm better than a good presentation about a Python library that you should have been using for the last 6 months. For me, those libraries are vcrpy and betamax, and that presentation was given by @sigmavirus24. I’ve been hand-writing responses for mocked external APIs like every freaking day since October 1.

Thanks PyTennessee! See you next year!

 

 

HTC Incredible Not Receiving Text Messages?

After a recent Android update, your HTC Incredible may have stopped receiving text messages. After an hour on the phone with Verizon Wireless customer service got me no where, I turned to the interwebs. Check out this message thread. The long and the short of is that you need to download and install a hotfix. Go to this URL with your phone’s web browser:

http://dl3.htc.com/misc/inc8049.apk

After the download completes, slide down the notification bar and click the file. You’ll need to enable installation of non-market apps for the hotfix to work, and you’ll be prompted to do so when you click the file. If you’re not, do Menu -> Settings – > Applications -> Unknown Sources and check it.

After you run the file all the messages you missed will download.

Here are the details of my phone, you might want to check your own before trying this hotfix on yours:

  • Hardware Version: 0003
  • Android Version: 2.3.4
  • Baseband Version: 2.15.10.07.07
  • Kernel Version: 2.6.35.13-g55a06e5 / htc-kernel@and18-2 #1 / Thu Aug 16 16:33:55 CST 2011
  • Build Number: 4.06.605.3 CL140944 release-keys
  • Software Number: 4.06.605.3
  • Browser Version: WebKit/533.1
  • PRI Version: 1.28_002
  • PRL Version: 52501
  • ERI Version: 5

Benchmarking Plone 3.3.5 with ApacheBench

Ever wondered what a good caching policy can do for your site’s performance? I’m deep in the throws of a ground-up Plone installation behind Apache, and I’ll be using CacheFu and Varnish to speed up the site. As I go along I’ll run ApacheBench at major milestones to see what difference they’re making.

The Command

ApacheBench comes installed with Apache, so no need to add anything new. To benchmark my site, I’ll run the following command:

ab -n 100 -c 3 http://127.0.0.1:8080/Plone/front-page

That’s 100 total requests, no more than 3 at the same time.

Initial Data

Here are the results from the “Welcome to Plone” page on a freshly created Plone site.

Server Software:        Zope/(unreleased
Server Hostname:        127.0.0.1
Server Port:            8080

Document Path:          /Plone/front-page
Document Length:        21120 bytes

Concurrency Level:      3
Time taken for tests:   34.529235 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      2140200 bytes
HTML transferred:       2112000 bytes
Requests per second:    2.90 [#/sec] (mean)
Time per request:       1035.877 [ms] (mean)
Time per request:       345.292 [ms] (mean, across all concurrent requests)
Transfer rate:          60.53 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   4.4      0      32
Processing:   263 1021 3556.2    528   34526
Waiting:      261 1019 3553.4    523   34494
Total:        263 1022 3557.4    528   34526

Percentage of the requests served within a certain time (ms)
50%    528
66%    553
75%    564
80%    575
90%    667
95%    967
98%   8281
99%  34526
100% 34526 (longest request)

Next, let’s see what happens when we add content.

With Data, Running on the Bare Zope Server

Since the site is running on ZEO, I decided to temporarily leave one client running on the bare Zope application server and set up one behind Apache. Here’re the stats for the non-Apache client.

Server Software:        Zope/(unreleased
Server Hostname:        127.0.0.1
Server Port:            8081

Document Path:          /Plone/
Document Length:        26136 bytes

Concurrency Level:      3
Time taken for tests:   42.539567 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      2641800 bytes
HTML transferred:       2613600 bytes
Requests per second:    2.35 [#/sec] (mean)
Time per request:       1276.187 [ms] (mean)
Time per request:       425.396 [ms] (mean, across all concurrent requests)
Transfer rate:          60.63 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   15 115.0      0     991
Processing:   408 1247 221.9   1221    2181
Waiting:       10 1235 253.2   1219    2179
Total:        820 1263 189.2   1221    2181

Percentage of the requests served within a certain time (ms)
 50%   1221
 66%   1225
 75%   1227
 80%   1231
 90%   1409
 95%   1596
 98%   2181
 99%   2181
 100%   2181 (longest request)

With Data, Running Behind Apache

… and here’s what I got on the client running behind Apache. I hadn’t spent any time on caching yet.

Server Software:        Zope/(unreleased
Server Hostname:        **************************
Server Port:            80

Document Path:          /
Document Length:        25745 bytes

Concurrency Level:      3
Time taken for tests:   46.875144 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      2602800 bytes
HTML transferred:       2574500 bytes
Requests per second:    2.13 [#/sec] (mean)
Time per request:       1406.254 [ms] (mean)
Time per request:       468.751 [ms] (mean, across all concurrent requests)
Transfer rate:          54.21 [Kbytes/sec] received

Connection Times (ms)
 min  mean[+/-sd] median   max
Connect:        0   12  87.6      0     740
Processing:   719 1385 2949.9    899   24272
Waiting:      264 1377 2935.4    899   24271
Total:        719 1397 2978.6    901   24272

Percentage of the requests served within a certain time (ms)
 50%    901
 66%    934
 75%    988
 80%   1031
 90%   1453
 95%   1954
 98%  19548
 99%  24272
 100%  24272 (longest request)

With Data, from my local machine

This is what it looks like from my local machine.

Server Software:        Apache/2.2.3
Server Hostname:        ***********************
Server Port:            80

Document Path:          /
Document Length:        0 bytes

Concurrency Level:      3
Time taken for tests:   3.004 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Non-2xx responses:      100
Total transferred:      25500 bytes
HTML transferred:       0 bytes
Requests per second:    33.29 [#/sec] (mean)
Time per request:       90.124 [ms] (mean)
Time per request:       30.041 [ms] (mean, across all concurrent requests)
Transfer rate:          8.29 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       26   44  13.6     39     101
Processing:    27   45  14.8     40     100
Waiting:       26   45  14.9     40     100
Total:         54   89  22.1     85     161

Percentage of the requests served within a certain time (ms)
  50%     85
  66%     95
  75%    101
  80%    108
  90%    122
  95%    137
  98%    143
  99%    161
 100%    161 (longest request)