Personal Projects

JJ’s VPS Memory Manager v1.1 – Released

1

Check out the download links on the side bar to the right. You’ll now see that v1.1 of my memory manager has been released. Since I’ve got to start my shift soon I’m just going to give a quick summary of the new features, starting with the most important:

1) Process list dumped to log on resize (date, used memory, suggested memory, and cache memory are all listed as well)
2) Ability to send email on resize request
3) Ability to tweet (uses oauth) on resize request

Check out the readme file for information on installation, upgrades, and configuration.

As always please don’t hesitate to contact me if you need help or have any questions!

Memory Manager v1.1 is Coming Soon

0

First off, thanks to everyone who has been actively testing and using this application and contacting me with feature requests and questions. The latest version of the memory manager (v1.1) will be coming out soon and with it will come, what I consider to be, an essential feature. With every resize there will be a dump of all running processes sorted by memory usage.

What does that mean to you?

Chances are you’re using this memory manager to help figure out where your memory is going and keep your services up and running. Having a snapshot of your processes, taken when the script sees the need for a resize, will tell you where your memory is actually being used. Very soon you’ll be able to review your logs and click on the “process log” link. I’ll be posting an update to the news you see within the memory manager when the newest version is ready.

JJ’s VPS Memory Manager v1.0 Release

0

I am very pleased to announce that today version 1.0 of JJ’s VPS Memory Manager has now been released. This version is considered stable and all reported bugs have been corrected. Go ahead and download version 1.0 (zip or tar.gz are available) and give it a try, if you run into any problems or have questions shoot me an email: jj@gimmesoda.com

More screenshots after the jump:

(more…)

JJ’s Memory Manager – Update Coming Soon

0

I’ve said this many times before, “I’m not a UI designer.” It’s true, I’ve got a 0 on the scale of design sense. However, I’m extremely thankful to say that there are many people out there who do, and I’m fortunate enough to have some great people around who are willing to help improve my projects. Due to wonderful people donating their time and efforts my memory manager is going to be getting a facelift (I’m really excited about this) and here’s a sample of what’s to come.

Is this not awesome?

Stay tuned, I’m hoping to get this pushed out as soon as the design is implemented on the remaining pages, which may take some time but should be out within the coming week.

Thoughts on VPS Memory Management

0

Recently, I have been spending a significant amount of time working on an application which manages the amount of memory assigned to a DreamHost Web VPS. During the time I’ve spent developing this several choices had to be made in what the real goal of the application had to be. When it comes to memory management on a server there are really two goals which don’t always play well together.

Goal One: Save Money

Many people seem to have a belief that just because the site/s are on a VPS, even with memory set as low as possible (300MB of RAM assigned to a machine in the case of a DreamHost VPS), they will have perfect or near perfect uptime. Sadly, this is not the case and often times this misunderstanding/confusion can lead to serious downtime and frustration. Ideally, for people who are trying to have the lowest amount of memory usage possible, a memory management application would realize that there is a need for more memory, calculate an estimated amount of memory needed to handle the increased usage, resize the VPS as closely as possible to that need, then downsize as soon as the memory is no longer needed.

There is one major issue with this scenario:

Creating estimates regarding the amount of memory needed in an environment where usage is constantly changing, is a massive challenge. To be more specific; since the ability to resize a VPS tends to take some time (anywhere from 1-5 minutes), it is possible for memory requirements to have increased during the time that the need was detected and the memory estimate was created. This could create a resize on a VPS with too little memory, causing problems for the website/s on the VPS, as the machine is given too little memory to handle the increased need.

Goal Two: Keep Services Running

If you are on a VPS, chances are you’ve outgrown shared hosting or are looking for more stability and control over the environment your applications run on. If you’ve got a decent understanding of servers, applications, and websites, you may also understand that you need to have enough memory to run all the processes and handle the requests to your sites. Often times simply setting your service to the lowest amount of memory possible is going to be asking for failed script executions and the dreaded 500 error being displayed on your site.

So with this understanding, some people go to the extreme and max out their VPS resources. At DreamHost that means $200 a month for services (4GB worth of RAM) which may not be fully utilized (and most likely are not). So the question here becomes how to balance cost and the need for memory, in order to keep services running without paying the maximum amount at all times.

A Hybrid Memory Manager Focused on Uptime

With these two potential goals in mind, I had decided to mainly focus my attentions on goal two. While I do understand the need to keep price as low as possible, it is my personal belief, gleaned from experience, that a downed website is more damaging to the bottom line than a slightly larger payment for hosting services. So with this in mind, the memory manager was created to focus on uptime, while still saving time and money for those who manually resize throughout the day, and potentially over-allocate memory for their site/s.

All this being said, I am quite excited to be releasing this software soon. The status of this release is currently closed beta. However, if you are interested in testing this on your DreamHost VPS, please contact me. I am looking to increase the pool of Beta testers before the official release.

Protected: JJ’s VPS Memory Manager, Closed Beta

0

This post is password protected. To view it please enter your password below:


A DreamHost VPS Memory Manager – Coming Soon

0

I’ve been working on this for awhile now and it’s almost ready! I’m just working out a better set of rules for figuring out what amount to resize to and I’ll be releasing the first beta!

Code Fix for Missing PATH_INFO

0

Many applications seem to be using the $_SERVER['PATH_INFO'] and related variables in their router section of code to figure out what information or page is being requested without having to write rewrite_rules for each possible request. It’s smart really! What about the web hosts that aren’t setting this information due to whatever reason?

While there are ways to getting this fixed on the server side, where I do agree it should be fixed, an application should be able to handle running in as many possible environments as possible. With that in mind I’ve found a way to ‘fake’ the information in PATH_INFO when it isn’t being set through the use of the argv array.

$path = (substr($_SERVER[argv][0], 0, 1) == "/") ? $_SERVER['argv'][0] : false;

This has been useful in my current patch for Concrete5 and should be useful for any app that depends on PATH_INFO.

Enjoy.

FLV Streaming Through Nginx Using JW FLV Player

0

I’m quite happy to report that the Nginx flv streaming module is part of the default Nginx setup on a DreamHost VPS. I finally took some time (much less then I thought it would be) to modify one of my old pseudo-streaming php scripts with a drop in replacement (3 lines of code) that basically just handles a redirect and uses the flv streaming module instead. You can grab a copy over here:

http://files.gimmesoda.com/dreamhost/nginx/nginx_stream.php

I use this particular script in conjunction with the rather popular JW Player:

http://www.longtailvideo.com/players/jw-flv-player/

However, at this point it looks like the newest versions of their player no longer recommends the use of streaming through a script and provides this functionality directly. This script is more for people like myself who don’t feel like upgrading to their branded versions of the player. The plugin functionality sure does tempt me but at a price of $89 for a video player to be used on a single site, I think I’ll stick to my current version, at least for now.

GimmeSoda.com Server Move: XCache, W3-Total-Cache and Nginx = Awesome

2

I’ve moved this site (gimmesoda.com) over to a test server (Private Server) I’ve got running on DreamHost. This server is running Nginx instead of Apache, both machines (the PS it was running on before, and the PS it is now running on) are set to 2GB of memory and the software setup of WordPress is exactly the same.

Why:

Apache can be a memory hog.

As more and more traffic comes into a website the Apache process continues to spawn memory hogging worker processes and during my basic testing I saw over 90 apache worker processes spawned at one time. Each of those processes were taking about 23MB worth of memory when spawned (23 x 90 = 2070MB) which maxed out the $100/month PS machine and returned several hundred errors at 100 concurrent connections.

Nginx handles concurrency much better and requires far less memory.

When the site was moved over to Nginx I ran the same test (1000 requests with 100 concurrency) and memory usage was under 800MB, it also returned 0 errors compared to the 664 from the use of Apache. Also, you should take note of the speed between the two in the results below, Nginx returned all requests in under 1s.

WordPress Cache Settings:

I’ve switched off the use of WP-SuperCache, which uses disk based caching and provides no further options such as opcode caching (APC/XCache/eAccelerator) which W3-Total-Cache does provide! Not only does it provide a static page cache as well as opcode options but it incorporates minify options, database, and object caching among other features.

All cache options have been set to XCache rather then disk, after all reading from memory is faster then reading from disk.

The Setup:

  • WordPress v3.0.1
    • Theme
      • I am using the Mystique theme, which thankfully does NOT use the timthumb.php script (I am NOT a fan of it).
      • Plugins
        • Akismet
        • All in One SEO Pack
        • Categories to Tags Converter Importer
        • Clean-Contact
        • Dragon Design Sitemap Generator
        • DreamHost WordPress Backup
        • FeedBurner FeedSmith
        • Google XML Sitemaps
        • Paypal Donate Plugin for WordPress Widget Support
        • Permalinks Moved Permanently
        • Piwiks Analytics
        • Twitter for WordPress
        • W3-Total-Cache
        • WordPress.com Stats
        • WordPress Importer
        • WP-FLV
        • WP-PayPalDonate

AB (ApacheBench) Results:

Apache Results Nginx Results
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.gimmesoda.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests

Server Software:        Apache
Server Hostname:        www.gimmesoda.com
Server Port:            80

Document Path:          /
Document Length:        30876 bytes

Concurrency Level:      100
Time taken for tests:   6.912 seconds
Complete requests:      1000
Failed requests:        664
   (Connect: 0, Receive: 0, Length: 664, Exceptions: 0)
Write errors:           0
Non-2xx responses:      664
Total transferred:      10878952 bytes
HTML transferred:       10588808 bytes
Requests per second:    144.67 [#/sec] (mean)
Time per request:       691.234 [ms] (mean)
Time per request:       6.912 [ms] (mean, across all concurrent requests)
Transfer rate:          1536.96 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1   15 164.4      7    3013
Processing:    24  511 782.2    190    4087
Waiting:       17  503 778.0    188    4074
Total:         46  526 792.6    196    4091

Percentage of the requests served within a certain time (ms)
  50%    196
  66%    266
  75%    499
  80%    744
  90%   2018
  95%   2703
  98%   2983
  99%   3060
 100%   4091 (longest request)
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.gimmesoda.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Finished 1000 requests

Server Software:        nginx/0.7.65
Server Hostname:        www.gimmesoda.com
Server Port:            80

Document Path:          /
Document Length:        30874 bytes

Concurrency Level:      100
Time taken for tests:   3.158373 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      31348328 bytes
HTML transferred:       30961170 bytes
Requests per second:    316.62 [#/sec] (mean)
Time per request:       315.837 [ms] (mean)
Time per request:       3.158 [ms] (mean, across all concurrent requests)
Transfer rate:          9692.65 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        1   22  11.8     20      63
Processing:    36  184 108.6    144     874
Waiting:        8   34  24.6     26     279
Total:         37  206 111.5    166     913

Percentage of the requests served within a certain time (ms)
  50%    166
  66%    209
  75%    251
  80%    273
  90%    347
  95%    405
  98%    569
  99%    641
 100%    913 (longest request)

More Information

Nginx: A web server written to address the C10K problem. http://wiki.nginx.org/Main

XCache: A fast opcode cacher, it’s a PHP extension. http://xcache.lighttpd.net/

W3-Total-Cache: A brilliant (and free) wordpress caching plugin that goes the extra mile. http://wordpress.org/extend/plugins/w3-total-cache/

Go to Top