January 31, 2005

Tuning Apache memory usage

Filed under: — 8:27 pm

Every now and then my web sites’ traffic (and the load on the servers) increases to the point where I have to do something about it. I start finding out whatever I can about optimizing Apache, MySQL, PHP, and other components, simplify my code and database queries as much as possible, then if that fails, start pricing higher-powered servers.

Last time this happened, a few months ago, the main server was running out of memory and nearly crashing several times a day. I ran across this O’Reilly article on tuning Linux web servers and followed a few of the suggestions that were new to me.

One thing that really helped: it seems that Apache threads gradually increase their memory allocation as they run, depending on what dynamic code you run with them. Setting the MaxRequestsPerChild parameter in httpd.conf forces it to start new threads periodically, and this memory growth process starts over. (I used the value 200, but you need to experiment with your server.)

It’s only a temporary measure, but this kept the server running smoothly for the last few months. The server load reached 20 (very bad) on a typical day before the change, and stayed around 5 (slightly bad) after.

Now traffic levels and server load have nearly reached critical again, so it’s back to the drawing board… Anyone got any amazing apache speedups?

January 28, 2005

Expose for Windows?

Filed under: — 12:15 pm

I’ve been playing with Macintosh computers in stores lately, and one of my favorite features is Exposé. Today my wife found an O’Reilly Article that mentions three Exposé-alike programs for Windows, all shareware in the $10 range. Here’s my quickie review of all three plus another option:

  • Winplosion: I tried this one and it works, although the animation is a bit clumsy (and this is a fast Windows XP machine.) You can set it to use F9 just like the Mac, but you have to press ESC rather than F9 again to exit. Worse, while it was running in the background I experienced some nasty delays—my computer suddenly couldn’t keep up with my typing. Needless to say, I uninstalled it quickly.
  • Entbloess: I read a brief review here that mentions that it (1) crashed, and (2) messed up the order for Alt-Tab switching. That’s enough to convince me to avoid it entirely.
  • Exposer for Windows: I tried to configure this one to use F9 as the hotkey, but it requires a Ctrl, Alt, Shift, or Windows key modifier, which misses the point of making it work just like a Mac. It makes no attempt to do graceful Apple-style animation when you hit the hotkey, and is slow—I actually laughed the first time I hit Alt-F9 and watched the windows disappear one at a time over a few seconds. It did speed up on subsequent uses, though, and at least it doesn’t crash or slow down the machine.
  • TopDesk: The article missed this one, but I found it in a Google search. It defaults to the Mac standard F9 key, and the animation is the best I’ve seen outside a Mac—but there’s still a disconcerting 2-second delay between the keypress and the animation. The tiled windows look great, changing color as you hover the mouse over them, and the window-opening animation is perfect. Alt-Tab seems to work normally. It’s even smart enough to know that Konfabulator isn’t a normal application that it should tile. If not for that delay and the hefty system requirements, it would be a great choice.

Conclusion: If I were desperate for this feature, I’d go with TopDesk. But that’s just the point—nobody is desperate for this feature. It’s a convenient luxury, but it’s not worth spending money or destabilizing your system, and if it’s the slightest bit slow, you may as well use the taskbar instead. So the snarky comment under the O’Reilly article that says “Just get a Mac” is, essentially, correct.

January 27, 2005

Useful tool: Keyword Tracker

Filed under: — 10:52 pm

I realized recently that there are a number of tools I take for granted that make my job easier—web services, software, and so on. I decided to write about some of them for those who might be unaware they exist. Here’s one now.

If you run a web site, you probably check its performance on Google, and maybe its PageRank, from time to time. If you run fifteen web sites, this process can be tedious. Fortunately, there’s Digital Point’s Keyword Tracker.

I use this tool regularly to check on a bunch of search terms for a bunch of sites, and it’s a big timesaver. It also encourages me to keep an eye on some things I normally wouldn’t have time for, and it lets me graph my sites’ performance relative to others in the field.

Keyword Tracker is free, but I believe you need your own Google API key to use it, and registration is required. It’s well worth it.

January 26, 2005

I finally bought a Mac

Filed under: — 6:35 pm

I’ve wanted an Apple Macintosh since the day they came out in 1984. I was in High School and my computer at the time was an 8-bit Atari. Barring a lottery win, there was no way I was going to afford one, so I forgot about that.

The next time I seriously considered buying a Mac was in 1992 when I saw a Performa 600 in a store. At the time my computer was an Atari ST, and I dreamed of owning a computer with better software support and better specs—32 mHZ, 4 MB of RAM, 80 MB hard drive.

Shortly thereafter I got a job working with PCs, then got a PC, and I’ve stuck with the Windows platform for various reasons. Meanwhile, Apple has kept making better machines and better operating systems, and I’ve been thinking for a while that I should have a Mac handy for testing my web sites. So when my PC notebook died, I ordered an ibook G4.

I’ve gone through ten or so computers over the years, but I must admit I’m excited to finally try a Mac. No, I’m not switching, and I refuse to enter any religious debate about which system is better. I’ve always been platform agnostic—I do as much work on Linux as on Windows—and this is one more platform I ought to have an understanding of. Besides, all of the cool kids seem to have them.

So, I’ve created a Macintosh category here and will be occasionally writing about some of my experiences and discoveries on that platform. I have seldom used Macs at all and never used OSX, so it should be interesting.

January 25, 2005

Traffic surges and PHP worms

Filed under: — 8:46 pm

This site may have been slow (or even unreachable) yesterday at times. I spent much of yesterday dealing with some major traffic surges on The Quotations Page, which shares one of its servers with this weblog.

Usually things like this are easy to trace, but this one kept me guessing for a while. In the end it turned out to be two things. First of all, the death of Johnny Carson resulted in over 20,000 visits to our woefully inadequate Carson Quotes page. It always makes me uncomfortable to get traffic because someone died, but it’s one of the prices of a high Google ranking.

The server could have easily handled those extra visitors, but something else was going on at the same time: hundreds of attempts per hour to load invalid URLs within our phpBB-based forum. Apparently another variation of the Santy worm is on the loose.

Our particular installations of phpBB weren’t compromised by the worm, but the constant requests to the viewtopic.php script were overloading the server. If you have a phpBB forum, even if it’s the latest version, I recommend setting up some mod_rewrite rules to block the requests entirely. After implementing some rules based loosely on the examples here, my server load went back down to manageable levels.

January 24, 2005

Teleflip: Easy text messaging

Filed under: — 8:46 pm

I have a system that is supposed to alert me via my mobile phone whenever one of my web servers is overloaded. It tries to give me an early warning when the server is so busy it might crash.

Previously, this never worked, because I used Sprint PCS for mobile service, and their email-to-SMS gateway was so slow that the server would be toast before I ever got the message. More recently, it never worked because I switched to T-Mobile, and my server can’t send email to T-Mobile.

My email is rejected at the SMTP level, regardless of which server I send it from. Apparently they’re using some kind of liberal spam blocking system that believes my server shares a network with spammers, or has tagged my server itself as a spammer due to the high volume of messages trying to alert me about server crashes. Regardless, it doesn’t work, and T-Mobile doesn’t offer me any control over how much spam filtering is applied to my email-to-phone account.

Fortunately, I found a solution: Teleflip is a free gateway service to send SMS messages to phones. The cool thing is that you can send email to number@teleflip.com and it will simply work, regardless of the mobile carrier. The other cool thing is that the messages get through to T-Mobile… at least until they decide to block it.

January 20, 2005

Followup on rel=nofollow

Filed under: — 1:31 pm

I previously mentioned Google’s announcement about the rel=nofollow attribute. There has been much enthusiasm about this, and much backlash against it, since then. It’s certainly not a miracle cure for anything, but I don’t see how it could hurt.

Yes, spammers will keep spamming. Eventually, three or four years from now, they’ll notice that their spam links are having less effect, but they’ll still do it—the fact remains that it’s little to no work for the spammer, so if even one person clicks on a link it’s still worthwhile. Just like email spam.

Many people have complained that this is only a good thing for Google—it just helps them sort out different types of links. Of course that’s true, but an advantage for Google is an advantage for all of us. If Google has more information about links, they can improve their search and ranking algorithms. We’ll see less spam in search results, even if we see just as much on our weblogs.

I’m not going to support the attribute on any of my sites. I monitor them daily and quickly remove any spam that gets through, so spammers already get no benefit here, and I want legitimate comments to get the benefit of their links. The biggest benefit for the web at large will be that there will no longer be thousands of abandoned weblogs out there that can be freely spammed with links that won’t be removed for years.

One more thing: as Scoble said, it’s amazing that Google was able to get their biggest competitors, and several other companies, to agree on this and implement it within a few days. Why can’t we see this kind of cooperation in the world of Instant Messaging?

January 19, 2005

Starling Fitness update

Filed under: — 4:51 pm

Laura and I launched the Starling Fitness weblog right before the beginning of the year, and she’s been working hard filling it with daily content. If you missed it the first time, please check it out, or read our original announcement for the details.

The site is two weeks old, and largely thanks to links on some of our other sites, we’re already getting decent traffic—an average of 300 visitors a day. Considering that we’re not getting any traffic from search engines yet, that’s pretty good. It should be interesting to see how a weblog on a mainstream topic like fitness can grow.

Within the last couple of weeks I’ve fixed the remaining minor issues with the site design—at least I think I have. Let me know if anything appears amiss.

January 18, 2005

Google supports anti-spam links

Filed under: — 5:44 pm

Google is rumored to be adding (confirmed) a new feature to help take the bite out of comment spam: a nofollow value that you assign to a link using the rel attribute. The idea is that you would add this attribute to links outside your control—such as URLs within weblog comments or forum postings. Here’s an example link:

<a href="http://www.figby.com/" rel="nofollow">

Links with this value wouldn’t transmit PageRank, or wouldn’t be followed by Google’s crawler at all. This is similar to the vote links concept in that you could link to a site (such as a spammer you’re complaining about) without giving them a positive endorsement, at least in Google’s view.

I have some concerns about how well this is going to work:

  • It needs support from all search engines, not just Google. I know most of us consider Google the most important, but the spammers would be just as happy to rank highly in MSN or Yahoo search. (update: see below)
  • It needs to be the default behavior in all major weblog applications and services before it will have any impact. This is going to take a while.
  • Spammers won’t get the message for a long time. Just like redirection schemes, it only works if the spammers believe it works, and that won’t happen until it’s supported across most search engines and weblog platforms. Even then, many spammers are likely to continue spamming weblogs for a year or two “just in case it helps.” Spammers are not known for their intelligence.
  • Is it really fair to take away the pagerank benefits of legitimate comments?
  • Dishonest webmasters will use this attribute to game the system. I’m not quite sure how, but they’ll find a way. One obvious way is to set the nofollow attribute on all external links, to prevent precious PageRank from leaking out of their sites. Whether this does any good or not is debatable, but they’ll do it anyway, and it’s bound to confuse the already-strained algorithms that produce PageRank.

I’m sure we’ll also see people who sell links based on their PageRank and then add the nofollow attribute later, making the purchased links worthless—but as far as I’m concerned, anything that hinders the widespread practice of selling links for ranking can’t be a bad thing.

Regardless, it’s a step in the right direction, and maybe someday there will be less comment spam on weblogs.

Update: Google’s official announcement has more details, including the fact that they’ve already got WordPress, Movable Type, and LiveJournal on board. Oh, and Yahoo and MSN are on board. This may just work…

January 17, 2005

Figby.com is 4 years old

Filed under: — 5:18 pm

I posted recently about the 10-year anniversary of my oldest site, The Quotations Page. I noticed today that it’s been four years since I first launched this weblog on January 16th, 2001.

When this site first appeared it had no traffic, as is typical with new sites. It also had a table-licious design, some home-made weblog software, and a rather serious case of delusions of grandeur. I thought I was going to out-do Slashdot with my coverage of tech news, despite only typing one paragraph whenever I felt like it. I also built a membership-based RSS aggregator into the site, something I like to think would have turned into Bloglines if I had the time and the venture capital.

At any rate, at some point I decided this site would focus on the one thing I was truly an expert on: my own opinions. In 2004, I managed to post at least once per month, something I had not accomplished in any previous year.

This year I’m taking online writing seriously, and for the last two weeks I’ve met my goal of one post per weekday. If all goes well I’ll post more this month than I did in entire years past, and as I get the hang of this thing I’m already getting better traffic. Here’s to many more prolific years!

January 14, 2005

EasyPHP Works!

Filed under: — 4:44 pm

I wrote about EasyPHP a couple of days ago. It’s a Windows installer that gets Apache, MySQL, PHP, and phpMyAdmin running with a minimum of fuss, and provides a simple GUI to start and stop the services. (Visit EasyPHP for details.)

Here’s a brief followup: it works as advertised. After copying the appropriate MySQL databases, Apache configuration files, and PHP configuration settings, I now have a working version of my major websites on my local machine. This should be very useful next time I’m updating a site—the usual cycle of change a few characters, upload, reload browser will be much quicker without the upload, and it might save me from the occasional incident when I mistype something and accidentally bring down a site.

Also, I completely forgot that I ran across XAMPP a while ago. It’s another package that includes Apache, PHP, and MySQL with a single Windows installer. I haven’t tried that one, so I can’t really compare the two. For the moment, EasyPHP works for me.

January 13, 2005

LCD Monitor Tips

Filed under: — 4:58 pm

I’ve been using an LCD monitor for several years and I’ll never go back to a CRT—while the colors aren’t as clear, at least on my ancient LCD, it’s tiny, looks cool, and most importantly I haven’t had a problem with eyestrain since switching. Since LCD monitors have crossed a price threshold and are now becoming more common than CRTs, here are three tips that might be helpful to new flat panel display owners…

[This article has been updated and moved to The Gadgets Page]

January 12, 2005

Color tools for the design impaired

Filed under: — 10:23 am

I’ll be the first to admit that I’m not a designer, just a programmer and writer. So I need a bit of help with things like choosing color schemes for a site. Fortunately, there are a number of tools that make that easier. Darren’s post today about one of them reminded me that I’ve been collecting links to color tools for years, and it’s about time I rounded them up into one place.

My two favorites are at the top, but I’ve found all of these useful at one time or another:

  • wellstyled: Color Scheme Generator 2: My favorite color brainstorming tool. Click on a color and it chooses six matching colors. You can choose different schemes for choosing colors (i.e. monochrome or contrasting) and can even choose the distance from your color for contrasting schemes. Another nice feature: view how your colors would look to those with various forms of colorblindness.
  • Eric Meyer – Color Blender: This one’s simple, but I use it more than anything else. Enter two colors (hex or RGB) and it displays any number of in-between colors. Excellent for finding an additional color or two for a site that already has a color scheme, or for modifying an existing scheme when you just want it a bit lighter or darker (blend with #FFFFFF or #000000).
  • ColorMatch Remixed: Nice and simple: use the RGB sliders to choose a color, and it picks nine complementary colors (some shades of your color, some shades of a contrasting color, and greys)
  • Color Harmonies: Non-JavaScript. Enter three RGB values and an array of colors is generated. These are mostly contrasting colors rather than shades of your color.
  • SlayerOffice – Color Palette Creator 1.6: Enter a color (hex) and it produces nine variant colors. These are strictly shades of your color, mixed first with white and then with black.
  • VisiBone Webmaster’s Color Lab: Click on a color in the palette and it displays a selection of contrasting colors (often very contrasting!)
  • Web Color Theory: This one doesn’t choose colors for you. Instead, it lets you drag colors from the palette onto a sample page layout to see how they will look.
  • Color Schemer: Click on a color (or enter one) and it displays a grid of 16 complementary and contrasting colors.
  • If these aren’t enough, ScriptyGoddess has an entire color tools category with many more links.

And if you want to learn how to choose colors rather than have a tool do it for you, here are some general articles I found helpful:

January 11, 2005

Local web testing: EasyPHP

Filed under: — 5:08 pm

I’ve never bothered to set up a local web server on my home network except as an occasional test. Occasionally I consider setting one up to use as a live preview of my web sites before I upload them, but the idea of configuring, installing, and running lots of GUI-unfriendly software on my Windows machine usually discourages me.

Recently I discovered EasyPHP, which, true to its name, makes this much easier. It’s a single installation file that gets MySQL, PHP, and Apache running under Windows. It took about 30 seconds to install and start the Web server on my Windows XP machine, and it worked the first time I tried it.

Rather than running in a DOS window, EasyPHP runs as a tray icon in Windows, and you can start and stop the services from the right-click menu. Unfortunately for uncultured Americans like myself, it defaults to the French language, so be sure to install the English language files, which provide the correct English localization for everything from the GUI to MySQL and PHP error messages.

Impressive! Now I could have real-time previews of my dynamic sites, at least in theory. I’ll have to do some work before I can really try it—the local server will need copies of my Apache customizations, MySQL databases and privileges, PHP settings… I’ll post a followup if and when I get it working.

(c) 2001-2007 Michael Moncur. All rights reserved, but feel free to quote me.
Powered by WordPress