rubysecurity.org

Anecdotes from a Linux Systems Administrator. /root

Home About Books Blog Portfolio Archive

Tag Cloud


Currently Reading

MCA Microsoft Certified Associate Azure Administrator Study Guide: Exam AZ-104
MCA Microsoft Certified Associate Azure Administrator Study Guide: Exam AZ-104
308 / 435 Pages


Latest Book Reviews

Latest Posts


April 9, 2013

OSSEC agent install issue on Debian Squeeze

by Alpha01

So the OSSEC installer has a conditional expression that doesn’t seem to be supported with the version of Bash in Debian Squeeze.

Error

3- Configuring the OSSEC HIDS.

./install.sh: 158: [[: not found

Fix (workaround)

Update line 372 on install.sh to the following:

if [ "X${USER_AGENT_SERVER_IP}" = "X" -a "X${USER_AGENT_SERVER_NAME}" = "X" ]; then

This was so frustrating, and it appears to be known issue. Unless I’m mistaken double brackets are only used in Bash to do a regular expression conditions, at least that’s the only time I’ve used them…

UPDATE: I also ran into this same issue on FreeBSD 9 and Ubuntu Server 12.04 LTS.

Resources

Tags: [ ubuntu security freebsd ]
April 1, 2013

ZFS on Linux: Stability Issues

by Alpha01

So far I’ve had one stability issue on my backup virtual machine. Though, I can’t really blame ZFS for crashing my VM, instead I believe this was a consequence the VM running out of memory due to large amount of rsync, and the heavy I/O caused on the ZFS drive.

After updating the dedicated memory on my backup VM from 512 MB to 3.5 GB and updating my rsync’s to run with low process and I/O priority, I have yet experience any more problems.

nice -n 19 ionice -c 3
Tags: [ zfs ]
March 27, 2013

PHP: XCache performance testing

by Alpha01

Aside APC, as far as I know XCache is the second most popular PHP caching optimizer. So I manually compiled and installed XCache on my www.rubyninja.org VM and configured the WordPress W3 Total Cache plugin to use the XCache optimizer and ran the same benchmarks test that I did when APC was enabled.

After a few tests, the total requests per second was around 24-25 seconds. Slightly slower than APC. However, unlike APC, I noticed that with XCache the overall server load was less (peak at about 3.3), in addition the I/O system activity also appeared to be less than with APC.

Concurrency Level:      5
Time taken for tests:   40.740110 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Non-2xx responses:      1000
Total transferred:      351000 bytes
HTML transferred:       0 bytes
Requests per second:    24.55 [#/sec] (mean)
Time per request:       203.701 [ms] (mean)
Time per request:       40.740 [ms] (mean, across all concurrent requests)
Transfer rate:          8.39 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    6 134.1      0    3000
Processing:    99  196  25.6    200     297
Waiting:       98  196  25.6    199     297
Total:         99  202 136.9    200    3209

Percentage of the requests served within a certain time (ms)
  50%    200
  66%    209
  75%    214
  80%    216
  90%    222
  95%    227
  98%    234
  99%    241
 100%   3209 (longest request)
Tags: [ php apache wordpress ]
March 25, 2013

Apache Stress Testing

by Alpha01

As I didn’t have anything much better to do a Sunday afternoon, I wanted to get some benchmarks on my Apache VM that’s hosting my blog www.rubyninja.org. I’ve used the ab Apache benchmarking utility in the past to simulate high load on a server but have not used it on benchmarking Apache in detail.

My VM has a single shared Core i5-2415M 2.30GHz CPU with 1.5 GB of RAM allocated to it.

I based made my benchmarks using a total of 1000 requests with 5 concurrent requests at a time.

ab -n 1000 -c 5 http://www.rubyninja.org/index.php

Results

Using just the mod_pagespeed Apache module enabled.

Time taken for tests:   154.687976 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Non-2xx responses:      1000
Total transferred:      351000 bytes
HTML transferred:       0 bytes
Requests per second:    6.46 [#/sec] (mean)
Time per request:       773.440 [ms] (mean)
Time per request:       154.688 [ms] (mean, across all concurrent requests)
Transfer rate:          2.21 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       3
Processing:   328  772  46.4    772    1040
Waiting:      327  771  46.4    772    1040
Total:        328  772  46.4    772    1040

Using mod_pagespeed and APC enabled.

Time taken for tests:   41.355400 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Non-2xx responses:      1000
Total transferred:      351000 bytes
HTML transferred:       0 bytes
Requests per second:    24.18 [#/sec] (mean)
Time per request:       206.777 [ms] (mean)
Time per request:       41.355 [ms] (mean, across all concurrent requests)
Transfer rate:          8.27 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    6 134.1      0    3000
Processing:    88  199  28.4    202     459
Waiting:       88  199  28.4    201     459
Total:         88  205 137.2    202    3208

Using the WordPress W3 Total Cache plugin configured with Page, Database, Object, and Browser cache enabled the APC caching method and mod_pagespeed.

time taken for tests:   37.750269 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Non-2xx responses:      1000
Total transferred:      351000 bytes
HTML transferred:       0 bytes
Requests per second:    26.49 [#/sec] (mean)
Time per request:       188.751 [ms] (mean)
Time per request:       37.750 [ms] (mean, across all concurrent requests)
Transfer rate:          9.06 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    5 133.9      0    2996
Processing:    74  181  26.6    185     315
Waiting:       74  181  26.6    184     314
Total:         74  187 136.4    185    3178

As you can see, APC is the once caching method that makes a huge difference. Without APC, the server response time was just 6.46 requests per second and the load average peaked at about 12, while with the default APC configuration enabled, the server response time was 24.18 requests per second, with a load average peaking about 3. Adding the W3 Total Cache WordPress plugin helped performance slightly more, from 24.18 requests per second to 26.49 requests per second (load was about the same, including I/O activity). One interesting thing that I noticed is that with caching enabled, that is APC, the I/O usage spiked considerably. Most notably, MySQL was the high cpu usage process when doing the benchmarks. Since the caching is based in memory at this point it appears that the bottleneck in the web application is MySQL.

Tags: [ apache php wordpress ]
March 19, 2013

Apache: Installing mod_pagespeed on CentOS 6

by Alpha01

Error

rpm -ivh mod-pagespeed-stable_current_x86_64.rpm
warning: mod-pagespeed-stable_current_x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 7fac5991: NOKEY
error: Failed dependencies:
  at is needed by mod-pagespeed-stable-1.2.24.1-2581.x86_64

Fix

yum localinstall mod-pagespeed-stable_current_x86_64.rpm
Tags: [ apache centos ]