Archive for September 20th, 2007

MythTV & Ubuntu

September 20th, 2007

GRRR. ARGH! AVAST Ye SALTY UBUNTU!
Sorry, ‘talk like a pirate day’ has passed, today is ‘frustrated with Ubuntu + MythTV day’ — which is almost synonymous.

If you get this error:

bbieber@baddog:~/mythtv/mythtv$ /usr/local/bin/mythfrontend
/usr/local/bin/mythfrontend: error while loading shared libraries: libmythtv-0.20.so.0: cannot open shared object file: No such file or directory

Pretty simple to fix, create a configuration file for ld.so which tells the linker where to find your libs -
sudo nano /etc/ld.so.conf.d/mythtv.conf

Then add this one line to it:

/usr/local/lib

and run sudo ldconfig

Then you should be good to go.

I now have MythTV running the latest from SVN on Ubuntu, only now my Gentoo box has an older version.
Take my advice, if you ever build a mythtv setup with multiple frontends – use the same OS on all your machines.
My setup consists of one custom built 3.4GHz P4 HTPC in our living room with 2 Happauge PVR 150 capture cards (dual tuners), a 1.2GHz Celeron Compaq Evo frontend w/Streamzap IR in the bedroom, and my desktop which is a 2.8GHz P4 with a pcHDTV HD-5500.
Eh… the best way to visualize this is to flex my Open Office Draw skillz, er maybe not.
On my master backend I went with Gentoo because I was always modifying and compiling the drivers for my PVR 150 capture cards (evidently I was the second guy after Chris Kennedy to use the PVR150 in Linux)… only now Ubuntu lags behind so far, I had to switch from using the packages to SVN. Now of course, Ubuntu is using protocol version 36, and Gentoo is behind with version 35. GRR. I can never win.

Why Aren’t You Using APC?

September 20th, 2007

I got a new Mac this week – Quad Core Dual 2.66 Intel, pretty sweet. Anyways, the Apple Migration Assistant can only transfer so much. I had to setup PHP 5, MySQL, as well as quite a few other manual install and custom configuration files. Well, I wasn’t getting the performance I was expecting out of my PHP apps, until I remembered that APC wasn’t installed.

Now I’m not that big of an optimization freak, so my code isn’t that lean and mean, but man APC does some amazing stuff.
Here’s the results of an apachebench [ab] on my localhost -

Without APC (~40 req/s):

ucommbieber:~ bbieber$ ab -k -c 50 -t 300 http://localhost/events/
This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Finished 12202 requests
Server Software: Apache/1.3.33
Server Hostname: localhost
Server Port: 80

Document Path: /events/
Document Length: 23809 bytes

Concurrency Level: 50
Time taken for tests: 300.002 seconds
Complete requests: 12202
Failed requests: 952
(Connect: 0, Length: 952, Exceptions: 0)
Broken pipe errors: 0
Non-2xx responses: 2
Keep-Alive requests: 0
Total transferred: 269977940 bytes
HTML transferred: 267940001 bytes
Requests per second: 40.67 [#/sec] (mean)
Time per request: 1229.31 [ms] (mean)
Time per request: 24.59 [ms] (mean, across all concurrent requests)
Transfer rate: 899.92 [Kbytes/sec] received

Connnection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 4.0 0 76
Processing: 117 1226 2243.5 1065 33964
Waiting: 117 1226 2243.4 1065 33936
Total: 117 1227 2246.6 1065 33990

Percentage of the requests served within a certain time (ms)
50% 1065
66% 1097
75% 1119
80% 1133
90% 1184
95% 1375
98% 1764
99% 3704
100% 33990 (last request)

With APC (~208 req/s)

ucommbieber:~ bbieber$ ab -k -c 50 -t 300 http://localhost/events/
This is ApacheBench, Version 1.3d <$Revision: 1.73 $> apache-1.3
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Finished 50000 requests
Server Software: Apache/1.3.33
Server Hostname: localhost
Server Port: 80

Document Path: /events/
Document Length: 23809 bytes

Concurrency Level: 50
Time taken for tests: 239.538 seconds
Complete requests: 50000
Failed requests: 0
Broken pipe errors: 0
Keep-Alive requests: 0
Total transferred: 1198823976 bytes
HTML transferred: 1190473809 bytes
Requests per second: 208.74 [#/sec] (mean)
Time per request: 239.54 [ms] (mean)
Time per request: 4.79 [ms] (mean, across all concurrent requests)
Transfer rate: 5004.73 [Kbytes/sec] received

Connnection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 2.0 0 101
Processing: 19 239 43.4 234 1489
Waiting: 19 238 43.4 233 1489
Total: 19 239 44.1 234 1489

Percentage of the requests served within a certain time (ms)
50% 234
66% 238
75% 241
80% 244
90% 254
95% 265
98% 294
99% 349
100% 1489 (last request)

And all you’ve gotta do is:
sudo pear install pecl/apc
sudo apachectl graceful

I went from 40 requests per second to 208 requests per second. Wowzers. You should seriously install it.