Skip to content

Cult of Tech.net Posts

New AIM Client, now I’m stuck with Message Storage, WTF

I updated the AIM client on my iPhone the other day and signed in to check out what the new software was like. As a side effect of this, I have also been upgraded to AOL/AIM’s new “Message Storage” system, where they keep logs of chat messages for 2 months (and hey they’re working on making it longer!) so they can be synced between mobile phones and multiple computers.

While I can see what you’re trying to do, you’ve done it in a intrusive, annoying, and down right shitty way; and it’s just about enough to make me stop using your chat network entirely.

Strike one, it’s not opt-in; it’s fuck-you-you’re-using-it-in.

I’m stuck with it now because I logged in with the new client on my phone. That’s it, no going back, and no warning that upgrading the client was going to permanently change my account to this new service. Nothing more than a note in the feature list that they can store and sync conversations between devices.

Strike two, it’s not opt out.

Don’t want AOL storing your conversations on their servers? Tough shit, you can’t turn it off. Well other than on a per conversation basis, which isn’t what I’d call opt out. However, there’s no where I can find to disable this shit completely and the FAQ does a very good job of indicating that I can’t disable it at all.

Moreover, since I don’t use the AIM client on my desktop, (I use Pidgin), so I can’t enable their “off the record” mode, which is a piss poor way to “opt out” in the first place. Doubly so when you have to enable it on a constant ongoing basis every time a conversation is started.

Strike three, what the fuck kind of dumb-shit programmer did you hire to implement this? The first message you send to someone after being forced into this shitty little service is prefixed with this lovely wall of text!

“%username%” is using a new version of AIM that stores conversation history so they can see their chats wherever they’re signed into AIM (desktop, mobile, aim.com). If you don’t want your messages stored, you can ask netmasteroc3 to take the conversation “off the record” or use the new AIM so you can do so yourself. Visit preview.aim.com/.faq for more information.

Okay, I can see the need to notify people that conversations are being stored. That’s nice, kind of, until you fucking spam someone with this 4 times in a row because they didn’t respond after the first one and don’t provide a way for the person sending the message to TURN THE FUCKING LOGGING OFF COMPLETELY IN THE FIRST PLACE!

Now when I start a conversation with people, and they start asking me what the fuck am I doing, and I have to explain to my non-techy friends that it’s not, in fact, me who’s logging the conversation, but the shit heads at AOL that have decided that every fucking converstation I start should be logged, simply because I upgraded the client on my phone. And guess what, even the techy ones have a hard time grasping that there’s no mechanism to opt out.

Thanks a lot ass-hats. Time to start migrating to GTalk.

Wordpress on Nginx on Dreamhost

By the time this is done being written I’ll have been running Wordpress on Nginx on a Dreamhost VPS. Better yet, I’ll be doing it with a smaller more well defined resource foot print, with better response times, and faster page loads than I had with Apache. The tradeoff, some more upfront configuration.

I’ve covered the broad strokes about my motivation here, here, and here. In short, Nginx offers a more consistent dependable level resource usage while still having the capability of scaling to serve may users, reducing the possibility of crashing the VPS while under moment of heavy load.

This is long, and may end up being multiple parts, so if you’re interested follow the jump and keep reading.

Getting a feel for the Nginx Stack

Forgive me, I’m about to ramble here.

For the past several months now I’ve been dealing with trying to get my VPS configured in such a way that it was stable and used as few resources (mostly RAM) as possible. During this process I had considered switching the web server from Apache2 to one of the lighter replacements. More and more I’ve been reading about the preference for Nginx (pronounced engine-x), along with PHP-FPM, as the defacto standard for high performance PHP sites.

Time to investigate.

The Nginx Stack

I swapped Apache 2 and mod_php out on my dev machine with Nginx and php-fpm a couple of days ago. Mostly to make sure everything would go smoothly if I decided to move my VPS over and figure out what rule changes I’d have to make to get Nginx running.

To start with Nginx doesn’t use the 1-process per connection model Apache does, instead it uses async IO. This addresses one of the biggest Apache problems I’ve had to contend with, a sudden spike in traffic spawning off a 10s of new processes, is no longer an issue at all.

Nginx’s memory foot print is comparatively tiny too. I’m seeing about 10MB total for the 2 workers + the master process, instead of 4-8MB or more per process.

Couple that with a fixed number of cgi processes on the back end (either with fastcgi or php-fpm) and you can account for most if not all of resources that will be used under any load conditions.

PHP

With Apache gone, so to goes mod_php and mod_fcgid. Neither are ideal solutions to running PHP sites, but those are the breaks (devsrv was running mod_php because it’s was what Ubuntu setup back when I installed it, and mod_fcgid is what Dreamhost uses).

Nginx does things a bit differently. PHP is run as a stand alone CGI “server” that Nginx proxies requests to. I find there are a couple of really nice advantages to this, especially if you can run php-fpm.

For example, you can pool cgi processes based on actual more broadly defined considerations rather than Apache’s process class. Say you have 3 vhosts, each running Wordpress, they can be served by a single pool of php processes that can share resources like a php-apc cache.

Ultimately, this means you can still control the number of backend processes that used for PHP, but can do so while still sharing resources where it makes the most sense.

Figuring and Managing Resources

With a VPS like Dreamhost’s where there are hard limits on memory usage, and since there’s no swap space you can’t really deal with overages when they occur other than to have the watchdog kill your VPS. In short, you really want to be able to account for resource usage and deal with transient spikes in a way that doesn’t result in spiraling resource usage.

Apache has always made this a fun exercise. Yes it can be done, but like I said, it’s fun trying to tune a fuzzy system optimally when there are hard limits.

With Nginx, I can count on the server’s staying exactly, or very nearly exactly, where they were at initialization. 2 worker processes + a controller process nets me between 8 and 12MB of RAM used, and it’ll be that much regardless of whether I have 1 connection or 100 connections. The CGI upstream servers are likewise manageable. With php-fpm you can let it spawn more processes, but you can just as easily limit it to 1 or 2 if resources are scarce. Simply put, it’s much easier to account for how much resources you actually need.

Performance

The whole point of Nginx is performance, but I’m not use to seeing 2 processes handle a lot of requests and that takes some getting use to.

I ran Apache Bench (ab) against my dev server to see just how it performed against Apache setup similarly to how it is in production and the results were certainly impressive to me.

Serving static content (cached HTML files, images, css, js, etc.) 2 Nginx processes could handle more than 2000 connections per second (over 1000mbit network). This is about 2x more than Apache2 was able to handle in about 1/30th the memory foot print.

Serving dynamic content is of course considerably slower, ~3 connections/second can be handled going though the full Wordpress PHP + MySQL stack with 4 php-fpm workers and xcache running.

It’s real hard to completely quantify all the variables, especially when I’m deliberately trying not to.

Conclusions

Okay I admit this post was sparse on details, I’ll try and rectify that in the near future. For now, let me just say, if you can switch to Nginx with your php application you should see better performance and lower resource usage than the same thing running under Apache. I certainly have.

So long Notepad++, and thanks for all the chmod +x

Just as soon as I post about changing from Notepad2 to Notepad++ I’m changing back as I’ve discovered an annoying issue where editing a Linux shell script with executable permissions over a samba share, removes the executable permissions.

What I can’t figure out is why it’s only removing the user’s execute permission. I had thought perhaps it was deleting and recreating the file, which would cause the share’s create mask to remove execute permissions, but that’s not it. If a file is set 0775, it will become 0655 after a save.

I may have a workaround for it in a few days, but for now I’m back to using notepad2 for my editing needs.

Replacing Notepad with Notepad++ using Image File Execution Options

I’ve been irritated for sometime by the apparent lack of desktop real estate when working on many webdev tasks in Windows 7. It may have been the same in WinXP, but honestly it’s been so long I don’t remember. While I don’t profess to be a greybeard or anything like that, I’ve yet to find an IDE that makes my life easier when working on PHP, JS, and CSS especially when most of the time I’m not doing much more than quick fixes.

For the longest time my solution to my conundrum has been to use Notepad2, actually a modified version of it Notepad2 w/ code folding. What I’ve noticed, and what’s prompted me to move away from Notepad2 is that the lack of tabs means that many times I’ll have a half dozen windows open as I try and find and fix whatever craziness I’m working on, and that was a large part of my lack of screen real estate.

My solution was, rather drastically, to dump Notepad2 and move to Notepad++. Unfortunately that brings it’s own issues to the table. The big one, and what prompted this post, is that Notepad++ doesn’t cleanly replace notepad completely. What you can do is have it take over the file extensions for the files you want it to edit. That of course brings it’s own set of problem, namely now your file types all read “Notepad++ file” instead of something more useful like what it actually is.

The best non-destructive way to replace Notepad is to use the Image File Execution Options hook in the registry to have windows launch Notepad++ instead of Notepad. The trick, unlike Notepad2 is that Notepad++ wasn’t apparently designed to be pluged in this way directly. There is a nice, article in the Notepad++ wiki on replacing notepad and that’s what brings me to this post.

The problem I’ve run into is that following their instructions it’s impossible to edit files with either spaces in their name or spaces in the path name. The procedure is the same as outlined by the Notepad++ wiki, only there’s a slight modification to the script that’s used. The the modified script is shown below.

Option Explicit
Dim sCmd, x, arg
sCmd = """" & LeftB(WScript.ScriptFullName, LenB(WScript.ScriptFullName) _
		- LenB(WScript.ScriptName)) _
		& "notepad++.exe" & """"
For x = 1 To WScript.Arguments.Count - 1
	arg = arg & " " & WScript.Arguments( x )
Next
sCmd = sCmd & " """ & trim(arg) & """"
CreateObject("WScript.Shell").Run sCmd, 1, True
WScript.Quit

Note: I’ve split the first sCmd line to make it fit on the page, the splits should work as well in the actual vbs file.

The key here is that script needs to collapse the file name arguments into a single quoted argument, which is what the for loop does now.

Hide from Sendto Menu

So the last time I posted I mentioned that you can quickly get to the sendto folder, to say add some shortcuts to it, by typing shell:sendto into the address bar in Explorer or from the Type to Search box in the Windows start menu. Today’s handy tip comes from wanting to remove something from the sendto without making it hugely difficult to recreate it if I so desired.

So to hide something from the sendto menu without deleting it from the sendto folder, simply open up it’s properties (right click -> properties) and check the Hide box. Easy as pie.

Reminders: So many, so frustrating.

Todo lists, tasks, reminders, whatever you want to call them I’m starting to think the correct name is pain in the asses. I currently have 5 completely incompatible implementations of tasks/reminders from 3 different providers, that don’t do me a bit of good since they can’t be synchronized between them.

First, there’s Tasks, in Mozilla Thunderbird/Lightning. It’s great that the Mozilla foundation though that a task list was worthwhile to include the only problem is no service seems to exist that they can be synced with. It won’t even let me create/sync them with the newish tasks feature that Google has added to Gmail/Google Apps for Domains.

Which brings us to Google’s tasks, long awaited and requested they finally got around to implementing them. Only catch is there doesn’t appear to be a way to synchronize them to something outside of Gmail, no support in Thunderbird, no way to get them on my phone. Maybe there’s better support if you’re on an android phone, but that has it’s issues as well.

Finally we have iCloud and Reminders, added to Apple’s iOS 5. Again, there’s no way to sync them (at least as far as I can tell) to a desktop client (at least not a Windows one), or for that matter get them out of iCloud. They sync between my phone and iCloud, I can edit and creat them from my browser though iCloud.com, but is that really ideal? Not to me. They do have a number of really cool features though, like the location based stuff.

NIH (not invented here) syndrome is driving me up a wall, why there isn’t a simple universally agreed upon standard for communicating tasks/reminders between various desktop and mobile devices. I shouldn’t have to fire up iCloud to add a task that I could have added while I was in Thunderbird replying to an email.

The more things go towards being digital, and especially in the cloud, the less they seem to be able to work well together. This, I think, needs to be fixed sooner rather than later, as it stands it’s just driving me up a wall.

Finally Done with this RAID project…

Three days of screwing around and as far as I can tell I’ve successfully moved all my data from one array to another while keeping the machine and data online the whole time–other than the few minutes of reboots to remove and replace hardware. Not bad for a SOHO file & web devel server.

Expanding things…

After the move was completed, and the array was re-syncing I expanded the LVM logical volume and the file system inside of it. Expanding the LV was simple and fast using lvextend (8) and the following command…

root@host:# lvextend data /dev/md#

It should take a couple of seconds while it allocates the new extents and returns and that’s done.

Expanding the ext4 FS takes a bit longer, but as long as it’s being extended and not contracted, it can be done while the FS is online and mounted.

root@host:# resize2fs /file/system/mount/point

Adding the -P to resize2fs (8) would be handy, if it works I didn’t try it, adding progress information as the resize is done.

/dev/md127, wtf?

Rebooting to remove the old, now archival, hard drive and bringing the system back up raised an interesting head scratcher. The MD device that should have come up as MD0, came up as MD127. The /etc/mdadm.conf file looked correct, but it wasn’t putting the device where it should have been in /dev. The fix seems to be rebuilding the intiramfs…

root@host:# update-initramfs -u

With that done and a reboot the md device shows up as md0 like it’s suppose to.

Additionally md apparently now supports assigning arrays descriptive names, like "hostname:1" and the array shows up under /dev/md/ as that name in addition to the regular /dev/md* device.

A note on the Hitachi 5k3000s

I went with these drives based on this post on the Backblaze blog. Well, with the caveat that I’m still leery of 3TB drives, so I’m using 2TB drives. I don’t even think that the board or the SATA controllers I have in this box support >2TB drives (though the update later this month will).

More interestingly, the Hitachi 5k3000s are 512-byte sector drives, not 4K sector “advance format” drives. While the 4K sectors do have advantages on large drives in terms of insuring data integrity they also become somewhat fun trying to partition and align around. Partitions have to aligned to 4K boundaries (fdisk, as well as Windows’ partition tools, align to 1M (2048- 512-byte sectors) when DOS compatibility mode is disabled), on top of that you have to be careful where the MD device places the metadata information, as that can shift the FS alignment as well. And for that matter, I have no idea what kind of overhead LVM adds in terms of alignment. In short, 4K drives are, IMO, still something of a mess, and probably will be fore sometime.

One nice thing is I’m seeing about 2x the performance of these Hitachi drives than I was with WD Greens, even though I believe they were properly aligned. Benchmarks show the drives I have can do 140MB/s on the other tracks, I don’t get that yet, but I’m hopeful that a new system with a faster CPU (Xeon E3-1220) and more modern SATA controllers (not the ancient SiI3114 on this Tyan Thunder K8W) will get me closer to that.

The Brass Tacks: What I learned

  • madam’s support for RAID 10 is lacking compared to all the other levels
  • LVM, especially pvmove (8) was more useful than just having a realizable volumes.
  • Planning storage, especially growth is a pain in the rear, when you can’t just throw a ton of disks at it

Breaking Arrays, Moving Data, LVM Good for something

Who knew LVM would be good for something. Well, maybe, I’ll know for sure sometime tomorrow, or late tonight, if it works it’ll be great, if it doesn’t. I’ll be damn glad I backed up these drives.

Yeah, so back to LVM. I always wondered if creating an LVM volume over the top of an MD raid volume was a good idea or if it wasn’t just adding extra overhead. And EXT4 partition can be extended without the help of LVM and so can an MD raid device. So why add the extra layer in there.

pvmove

That’s why.

Breaking Arrays, Making Arrays

Wanting to avoid the “blow it away and restore from backup” strategy, especially since WD Caviar Greens are so damn slow compared to just about everything else, I decided the best course of action would be to split the existing unresizable md array and create a new second one. Something like….

mdadm /dev/md0 --fail /dev/sdb1
mdadm /dev/md0 --remove /dev/sdb1
mdadm --create /dev/md1 --level=1 --raid-devices /dev/sdb1 missing

The end result, 2 degraded but fully functional md arrays. One still hosting the data volume group with my home logical volume, and one with a big empty disk.

The trick now is to move the data.

LVM Really is Good for Something

The question of how to move the data stumped me for a bit. I could create a new volume group (VG), or at least a new logical volume in the same data VG I already had, format it, and rsync the data across. Of course then I would have to edit at least my /etc/fstab and to get things pointed to the right place. The alternative that came up as I was digging though the LVM documentation is a nifty function called pvmove (8) that will move the physical extents of an LVM from one physical drive to another in a volume group (or to multiple drives in a volume group if needed). Moreover, as best as I can interpret the docs, it does this in a way that’s safe to do with the system online.

All told, for my system, the process looked something like this…

vgextend data /dev/md1
pvmove /dev/md0 /dev/md1

Now it’s back to the waiting game. It’ll be 5 or 6 hours before the pvmove is complete, then I have to tear down the md0 raid array and add the /dev/sdd device that’s left in md0 to md1. That will necessitate a 6, or so, hour re-sync. After which, I’ll reboot, make sure md1 becomes md0 and everything is found properly. Then it should hopefully be a short task of expanding the logical volume from 1.5TB to 2TB and then the EXT4 file-system inside of it. If not, well I’ll be damn glad I made that 6-hour long backup, wont I?