Webserving on Eight Megabytes a Day

Nicole Valentine asked me about turning an 8 megabyte PowerMac 7100 into a non-dedicated web server. Fortunately, she has ISDN, so she doesn’t have to deal with all the vagaries of a serial modem connection, and can work with the reliability and robustness of the built-in Mac Ethernet software.

I’ve had other questions about this as well, so I decided to tell her more than she wanted to know and put the whole thing up for the world to see.

“Non-dedicated” means that, not only is the Mac serving to the net, it’s also being used as a normal production Macintosh for spreadsheets, word processing, and net surfing.

You want to use your home, eight megabyte Mac as a web server?

Well, you’re going to find it a tight fit. I ran a non-dedicated 8 meg Mac IIcx when using System 7.1. I haven’t tried it with system 7.5, but in fact it worked surprisingly well. There are some people who claim that everyone, even the normal user, needs at least 24 meg. Apps are taking up more memory than they did two years ago when Cerebus the Gopher was a dinky old Mac II. However, they aren’t taking up that much more memory, and you can in fact run a Pretty Good Webserver in 8 megabytes.

Yeah, right. How?!

  1. Look into MacHTTP rather than WebStar; besides being cheaper, it claims to be able to run with only a little over 1150k. WebStar claims at least 1250k, and that 100k is going to make a difference when you haven’t got much to begin with. If the choice is WebStar or 16 Megabytes of memory, my personal choice is the memory—the $400 difference in price will easily pay for two 4-MB chips.
  2. You might also try NetPresenz. Besides allowing you to serve via FTP and gopher, it seems to generally use less memory. It actually prefers 1000k, freeing another 150k for your other apps. (Version 4, the latest, will do CGIs.)
  3. Don’t buy any overloaded apps to use on your computer. Unfortunately, you’re probably going to have to use Netscape, just so you can check out your pages. But you may find it easier to use MacWeb for general testing and netsurfing—it uses many a megabyte less memory. And stay away from Microsoft Word: besides being a memory hog, it also adds lots of junk to your system folder and, in my experience, drastically reduces reliability. I’ve found ClarisWorks to be an admirable word processor, database, spreadsheet, and page layout package. BBEdit Lite 3.5 is a great small text editor, with HTML extensions available. Microsoft Internet Explorer, on the other hand, maintains a relatively reasonable memory footprint.
  4. Whenever you buy any software, make sure you find out beforehand how much memory it uses. Then, do an “About This Macintosh” on your webserving Mac and see if enough is left to actually run the software.
  5. Go with PowerMac Native apps, and turn Virtual Memory on—to 1 Megabyte extra. I’d prefer to be able to turn VM on to 0 megabytes, but it isn’t an option. VM allows only the useful parts of the software to be loaded into memory, and memory requirements go down. MacHTTP, NetPresenz, Clarisworks, Netscape, are all native. The memory requirements I’ve mentioned above all assume that you have VM turned on.
  6. Be careful when paring down memory. Some apps, especially the memory hogs you’ll be most tempted to pare down, become unreliable if you go lower than the “recommended” setting, even if you are still higher than the “minimum” setting. Netscape, for example, claims to be able to run in 1784 kilobytes. I’ve never had any luck running it in less than 3000 kb. (And that’s with VM turned on—on a PowerMac without VM turned on, it’ll take 4000 kb.)
  7. Drop your disk cache (use the Control Panel, Memory) down to 64k or 128k. It can go as low as 32k, but that’s probably too low.
  8. Stay aware of how much memory your CGIs use! CGIs don’t take up much memory—200k is a lot for an Applescript CGI—but if you happen to be filling up memory with your other apps, and someone chooses your CGI, there may not be enough memory left to load it! So keep an eye on your remaining memory, and make sure that there’s always enough to load up one more CGI.
  9. If time isn’t a factor, and you’re using MacHTTP, consider saving your scripts as text only, with the “.script” extension, and then allocating another 100k or so to MacHTTP. Your scripts will now use MacHTTP’s memory allocation. If you’re using WebStar, don’t do this, because WebStar’s “.script” support is a vestigial remnant of MacHTTP’s, isn’t supported, and is slated for the axe in future releases.

I don’t believe it.

Here’s an example of what you can expect each item to use:

SoftwareMemoryRunning Total
System 7.5.141654165
NetPresenz10005165
BBEdit Lite 3.5.14505615
ClarisWorks 4.0v214007015
Remaining1181

Which leaves room for up to five concurrent 200k Applescripts or other CGIs. That 4165 looks like a lot. I may have to dig through my System Folder and see what’s taking up all that space. Our 7100/80 at school has less then 3000 kb once you subtract the monster cache we give it. If you can drop your system folder down to, say, 3200 kb, that’s an entire other application you can have running at the same time as everything else!

Other application memory requirements include the following. Note that, with only System 7.5 and NetPresenz running, you have 8196 minus 5165, or 3031 kb left over.

SoftwareMemoryFree Memory
GraphicConverter300031 kb Careful!
Netscape3072Pare it to 3000 and pray!
MacWeb2048917 kb

Examples

Scott Koziki is going even further out than I am: a five megabyte (albeit dedicated, I assume) web server:

I’m using a IIsi with 5Mb (!) of ram (16 using VM) to serve a site. It’s running NetCloak, MapServe, sometimes the admin.acgi, and a custom AppleScript that changes logs out on the fly. It gets beaten to death (30 connections at a time, constantly, 24x7) and has never crashed (except with the NetCloak problem, but that was an easy fix). According to my logs, this tiny server has served over 2Gb in about 2 months. We nicknamed it Rocky. =)