TweetFollow Us on Twitter

Jun 99 Factory Floor

Volume Number: 15 (1999)
Issue Number: 6
Column Tag: From The Factory Floor

A Conversation with Chuck Shotton

by Chuck Shotton and Dave Mark, ©1999 by Metrowerks, Inc., all rights reserved.

This month's Factory Floor interview is with Chuck Shotton, known by many as the father of Macintosh web servers. Chuck was the author of MacHTTP, the first Macintosh web server, which later became WebStar. Chuck took time out from his latest groundbreaking progamming project to give us his side of the story.

At various times, Chuck Shotton has toiled in the salt mines of defense contracting, under the yoke of academia, and in the trenches of private enterprise. His latest exercise in humility is as CEO of BIAP Systems, Inc. where he, along with a cast of thousands, alternates between groveling before mighty VCs and flogging lowly C compilers to do his bidding in a quest to create the Next Killer App (tm) for the Internet. Coming soon to a CRT near you!

Dave: How did you get started with Mac Programming?

Chuck: In one of my previous lives, I worked for a defense contractor in the Washington, DC area. One of the few bright spots in that otherwise Dilbert-esque landscape came along in late 1984 when we got our first Macs to play with. Turns out that most of the guys in my department were old Apple ][ fans and a little arm-twisting resulted in some screaming 8 mHz, dual floppy 128k Macs. We were supposed to port a large chunk of code from a Vax 11/780 to these Macs (which actually had more RAM than the Vax!) for a process management system used by the Navy. At that time, "Inside Mac" wasn't really available and the total extent of the Mac programming documentation available to me consisted of back issues of MacTutor magazine and the Consulair C Compiler's instruction manual. So basically, I learned Mac programming at taxpayer expense on a contract for the Navy by sitting around all day reading old magazines and disassembler output.

My first real dose of uninhibited (read that "unclassified") Mac programming didn't come until 1986 when I started working on a contract in my spare time for Simutronics, which developed most of the popular on-line games for the GEnie on-line service. I built the graphical front end for Mac players of the "Orb Wars" game. I think that was the one and only time I ever got to work on game software for money and it's been down hill ever since.

Dave: What can you tell me about the early days of MacHTTP?

Chuck: MacHTTP was one of those life altering events that you don't really know whether it was good or bad until a long time afterwards (turns out it was good - mostly). In late 1992, rumors of this World Wide Web thing were floating around in the scientific community. Most people involved in academic information systems at the time (I was working at the U. of Texas in Houston then) were drooling over Gopher, Archie, and other text-based interfaces to existing Internet services. I decided to give the Web a try and began corresponding with the guys at CERN in Switzerland. Because almost everything was Unix-based at the time, I wanted to work on a Mac Web browser. Tim Berners-Lee wrote back that CERN had a great Mac browser in the works (anyone remember the CERN web browser?) and maybe I should look into writing a server for the Mac instead.

So MacHTTP sprang into being in early '93 after an all night coding session. In its original incarnation, it handled exactly one connection at a time, had this Byzantine event loop that split its time between babysitting the MacTCP driver and looking for the user to type command-Q, and served anything on your hard disk. I still had to test it with a Unix browser until NCSA released the first Mac version of Mosaic, but the Mac OS was now the proud host of the second Web server on the planet after the Unix one created by the guys at CERN.

Another 6 months of tweaking, fiddling, tuning, and very little interaction with sunlight resulted in the first shareware version of MacHTTP. By the middle of '94, MacHTTP had become the proverbial self-eating watermelon. Developing, testing, supporting, and selling a software product by yourself can get to be a herculean task. Even with my wife and I working at it (she was a C coding geek as well, though a reformed Ada zealot now), it was too much to do as a part time effort. We ended up flipping the baby, the bathwater, and my day job over the fence to StarNine Technologies in April of '95 and WebSTAR was born.

Dave: What lessons did you learn in bringing MacHTTP to market?

Chuck: Take cash!. If you can grow a product into something that gets on peoples' radar scopes, someone will offer to make your life easier by taking it off your hands. Take cash! Seriously though, I think the biggest lessons learned had to do with understanding how big companies (like Apple and Quarterdeck) do business and what technology-driven individuals have to do to survive in that commercial environment. Being able to build a community of users and developers around a product and stay with it from start to finish is a luxury that few people get to experience. Finding good people to work with (the DTS guys at Apple, StarNine's management team, etc.) made my life a lot easier.

Dave: As MacHTTP evolved, Apple was spinning their own Open Transport TCP/IP technology. How did you deal with this?

Chuck: Open Transport was probably one of the most painful O/S transitions Apple has ever inflicted on its developer community. Just at the point that MacTCP was becoming well-understood in the developer community, widely distributed, and pretty much universally supported, along comes OT. As with most examples of not-invented-here syndrome, OT was based on the mostly unsupported STREAMS interface instead of the nearly universally supported Berkeley Sockets interface. So not only did developers have to rewrite all their code to use the new APIs, but they had to learn something from scratch that most of them had never seen before and didn't really work for the first 3 releases.

OT was definitely a case where it didn't pay to be an early adopter. In fact, it was unusable for server applications until its third release due to memory leaks, odd timing errors with large file transfers, and premature connection terminations. We managed to accomodate it pretty easily once it was debugged because WebSTAR was built to our own TCP/IP APIs and not the lower level O/S specific APIs for MacTCP, OT, or BSD. That's not to say we had our own TCP/IP stack, just that we chose to wrap the low level stuff in some easier to use code. That philosophy was used throughout much of WebSTAR and it made it a lot easier to accomodate changes in the O/S than other code that was written to the native O/S APIs.

Dave: What did you have to do to create a real high performance server on the Mac OS?

Chuck: Most well-written servers turn out to be I/O bound applications. They spend most of their time shoving data from point A to point B and very little time actually doing anything to the data itself. For all the rocks that get thrown at it, the Mac O/S can still outperform servers running on other platforms like Linux if the code is well-written. One of the biggest fallacies is that the Mac's tasking model is bad (not preemptive) and the file system is slow. I won't argue the latter point, but the former is totally bogus.

The Thread Manager is actually a server developer's best friend if you use it right. Operating systems like Unix (prior to standard implementations of lightweight threads) have to run parallel threads of execution as separate processes. That means heavy-duty context switches and a very crude control over task priorities and how control is relinquished. That generally equates to poor performance in a multi-threaded application with lots of context switches (like a Web server). On the Mac, the Thread Manager allows for really quick context switches that are completely under the control of the application. If you know it's time to handle a new incoming connection, your code can yield directly to the code responsible. Or if you know you're waiting on a remote client to disconnect, you can pass control to another thread that is in the middle of a massive file transfer. Being your own scheduler is a good thing if you have a well-understood process that you are implementing. Relying on a generic O/S-level scheduler results in pretty lame performance compared to a highly-tuned, application-specific scheduler built on a threading environment like the Thread Manager.

There were two other major areas of optimization that helped tune MacHTTP and WebSTAR to the Mac O/S. The first was data caching. Since it's costly to find a file in the Mac O/S (either to read data from it or to find file system attributes like the creation date), caching this information for future use provided one of the biggest performance increases. In-memory databases are all the rage now and they are basically fancy caching mechanisms much like the ones these Web servers used. If you can come up with a good algorithm for managing cache hits, you can end up with a large majority of your data requests coming out of memory instead of ratting through B-Trees on disk trying to locate Finder info.

Accomodating the idiosyncracies of the Mac's networking code provided the final big performance boost. Simple things like double-buffering your data output so that one write operation is always awaiting the completion of its predecessor ensures that the network connection is always fully utilized. Reading data into buffers larger than the default sizes makes sure that you don't waste a lot of CPU cycles processing small amounts of data lots of times. Too many context switches between threads can occur if you don't have the right balance between I/O time and calculation/processing time. Spend more time reading or writing data since that takes a lot more time to perform than the calculations the server has to perform on the data. A lot of this stuff is just common sense, but it's amazing how many developers don't bother to tune their code for best performance after they have the basic functionality up and running.

Dave: How does an app developer deal with the rich mix of connection types and speeds (e.g., slow dial-ups to high bandwidth direct connect)?

Chuck: That's a big challenge for the next generation of Internet apps. The current crop of Web browsers and servers typify the one-size-fits-all approach to network software development. Application performance is metered by the user's patience level and is in direct proportion to the available network bandwith. This results in adequate performance if you have a large network pipe and painfully slow performance if you're sucking data through a 28.8 soda straw.

Ideally, the data and application performance should scale with the performance of the network. A user with a 28.8 dial-up connection should have application performance just as perky as someone using an ADSL connection. The way to accomodate this is to write smarter software that can select data appropriate for the connection speed and adjust dynamically to changing CPU and network loads. Intelligent caching, back-side information sharing on the LAN, and distilled content (e.g., discarding banners, eye candy, and other non-informational content) can get just as much useful data through a dial-up line as currently flows over a T1, from a user's perspective.

We're working on a new generation of desktop network applications (super secret codename, "Gossip", for the terminally curious) that takes a shot at implementing some of these concepts. We have to very carefully monitor the user's available bandwidth, their usage patterns, the types of data they are interested in, and adjust the clients' interaction with the net accordingly. It's hard to write smart software. I think that's the next big hurdle for developers trying to develop apps for the Internet. All the niches for dumb products are filled with stuff from Microsoft, Sun, AOL, and other NASDAQ luminaries. If you want a piece of this market now, your software better do something smart for a change.

Dave: What advantage do I have as a Mac Develper dealing with the web and the internet?

Chuck: The Mac's singular advantage over every other platform centers around AppleEvents and scripting. And unfortunately, it's one of its most underutilized and underadvertised features. Apple birthed a phenomenal technology with AppleEvents. I've advocated a cross-platform version of AppleEvents since the day after I read that chapter in Inside Mac. But until then, the ease with which complicated Web-based applications can be put together on the Mac is unrivaled. Sure, you can muck around with active server pages, glom together some Perl scripts, or hack out some custom CGIs. But nothing available on any other O/S rivals the ease with which you can hook two distributed applications together via AppleEvents. I wish Apple would revisit this technology and consider a cross-platform version that runs over TCP/IP. Until then, Mac developers can smugly take advantage of a feature that doesn't really exist on any other platform.

Dave: What are you focused on these days?

Chuck: I'm back at the helm of BIAP Systems, Inc. We just finished relocating the company's main offices from Houston, TX to Leesburg, VA and are busily at work on the Next Big Thing (tm). Much of last year was spent raising money for this exercise and we're finally getting to roll up our sleeves and sling some code again. We're primarily focused on software that creates communities. That's an outgrowth of some of the personal server concepts we kicked around with MacHTTP and WebSTAR as well as the chat server development we did last year at BIAP. It's all cross-platform stuff this time and we're torturing ourselves with the prospect of getting the same chunks of code running on the Mac, Windows, and Linux. If you know anybody that wants to help, give us a holler.
 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Combo Quest (Games)
Combo Quest 1.0 Device: iOS Universal Category: Games Price: $.99, Version: 1.0 (iTunes) Description: Combo Quest is an epic, time tap role-playing adventure. In this unique masterpiece, you are a knight on a heroic quest to retrieve... | Read more »
Hero Emblems (Games)
Hero Emblems 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: ** 25% OFF for a limited time to celebrate the release ** ** Note for iPhone 6 user: If it doesn't run fullscreen on your device... | Read more »
Puzzle Blitz (Games)
Puzzle Blitz 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Puzzle Blitz is a frantic puzzle solving race against the clock! Solve as many puzzles as you can, before time runs out! You have... | Read more »
Sky Patrol (Games)
Sky Patrol 1.0.1 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0.1 (iTunes) Description: 'Strategic Twist On The Classic Shooter Genre' - Indie Game Mag... | Read more »
The Princess Bride - The Official Game...
The Princess Bride - The Official Game 1.1 Device: iOS Universal Category: Games Price: $3.99, Version: 1.1 (iTunes) Description: An epic game based on the beloved classic movie? Inconceivable! Play the world of The Princess Bride... | Read more »
Frozen Synapse (Games)
Frozen Synapse 1.0 Device: iOS iPhone Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: Frozen Synapse is a multi-award-winning tactical game. (Full cross-play with desktop and tablet versions) 9/10 Edge 9/10 Eurogamer... | Read more »
Space Marshals (Games)
Space Marshals 1.0.1 Device: iOS Universal Category: Games Price: $4.99, Version: 1.0.1 (iTunes) Description: ### IMPORTANT ### Please note that iPhone 4 is not supported. Space Marshals is a Sci-fi Wild West adventure taking place... | Read more »
Battle Slimes (Games)
Battle Slimes 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: BATTLE SLIMES is a fun local multiplayer game. Control speedy & bouncy slime blobs as you compete with friends and family.... | Read more »
Spectrum - 3D Avenue (Games)
Spectrum - 3D Avenue 1.0 Device: iOS Universal Category: Games Price: $2.99, Version: 1.0 (iTunes) Description: "Spectrum is a pretty cool take on twitchy/reaction-based gameplay with enough complexity and style to stand out from the... | Read more »
Drop Wizard (Games)
Drop Wizard 1.0 Device: iOS Universal Category: Games Price: $1.99, Version: 1.0 (iTunes) Description: Bring back the joy of arcade games! Drop Wizard is an action arcade game where you play as Teo, a wizard on a quest to save his... | Read more »

Price Scanner via MacPrices.net

14-inch M4 Pro/M4 Max MacBook Pros on sale th...
Don’t pay full price! Get a new 14″ MacBook Pro with an M4 Pro or M4 Max CPU for up to $320 off Apple’s MSRP this weekend at these retailers…they are the lowest prices available for these MacBook... Read more
Get a 15-inch M4 MacBook Air for $150 off App...
A couple of Apple retailers are offering $150 discounts on new 15″ M4 MacBook Airs this weekend. Prices at these retailers start at $1049: (1): Amazon has new 15″ M4 MacBook Airs on sale for $150 off... Read more
Unreal Mobile is offering a $100 discount on...
Unreal Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering a $100 discount on any new iPhone with service. This includes new iPhone 16 models as well as iPhone 15, 13, and SE phones... Read more
16-inch M4 Pro MacBook Pros on sale for $250-...
Don’t pay full price! Amazon has 16-inch M4 Pro MacBook Pros (Silver or Black colors) on sale right now for up to $300 off Apple’s MSRP. Shipping is free. These are the lowest prices currently... Read more
Get a 14-inch M4 MacBook Pro for up to $240 o...
Amazon is offering a $150-$250 discount on Apple’s 14-inch M4 MacBook Pros right now. Shipping is free. Be sure to select Amazon as the seller, rather than a third-party seller: – 14″ M4 MacBook Pro... Read more
Clearance 14-inch M3 Pro MacBook Pros availab...
B&H Photo has clearance 14″ M3 Pro MacBook Pros (in Black or Silver) on sale for $500 off original MSRP, only $1499. B&H offers free 1-2 day delivery to most US addresses: – 14″ 11-Core M3... Read more
Sams Club is offering a $50 discount on Titan...
Sams Club has Titanium Apple Watch Series 10 models on sale for $50 off Apple’s MSRP. Sams Club Membership required. Note that sale prices are for online orders only, in-store prices may vary. Choose... Read more
Sunday Sale: Apple’s latest 13-inch M4 MacBoo...
Amazon has new 13″ M4 MacBook Airs on sale for $150 off MSRP right now, starting at $849. Sale prices apply to most colors and configurations. Be sure to select Amazon as the seller, rather than a... Read more
Apple’s M4 Mac minis on sale for record-low p...
B&H Photo has M4 and M4 Pro Mac minis in stock and on sale right now for up to $150 off Apple’s MSRP, each including free 1-2 day shipping to most US addresses. Prices start at only $469: – M4... Read more
Week’s Best Deals: 14-inch M4 MacBook Pros fo...
Don’t pay full price! These retailers are offering $200-$250 discounts on new 14-inch M4 MacBook Pros this week…they are the lowest sale prices available for new MacBook Pros: (1): Amazon is offering... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.