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

Tokkun Studio unveils alpha trailer for...
We are back on the MMORPG news train, and this time it comes from the sort of international developers Tokkun Studio. They are based in France and Japan, so it counts. Anyway, semantics aside, they have released an alpha trailer for the upcoming... | Read more »
Win a host of exclusive in-game Honor of...
To celebrate its latest Jujutsu Kaisen crossover event, Honor of Kings is offering a bounty of login and achievement rewards kicking off the holiday season early. [Read more] | Read more »
Miraibo GO comes out swinging hard as it...
Having just launched what feels like yesterday, Dreamcube Studio is wasting no time adding events to their open-world survival Miraibo GO. Abyssal Souls arrives relatively in time for the spooky season and brings with it horrifying new partners to... | Read more »
Ditch the heavy binders and high price t...
As fun as the real-world equivalent and the very old Game Boy version are, the Pokemon Trading Card games have historically been received poorly on mobile. It is a very strange and confusing trend, but one that The Pokemon Company is determined to... | Read more »
Peace amongst mobile gamers is now shatt...
Some of the crazy folk tales from gaming have undoubtedly come from the EVE universe. Stories of spying, betrayal, and epic battles have entered history, and now the franchise expands as CCP Games launches EVE Galaxy Conquest, a free-to-play 4x... | Read more »
Lord of Nazarick, the turn-based RPG bas...
Crunchyroll and A PLUS JAPAN have just confirmed that Lord of Nazarick, their turn-based RPG based on the popular OVERLORD anime, is now available for iOS and Android. Starting today at 2PM CET, fans can download the game from Google Play and the... | Read more »
Digital Extremes' recent Devstream...
If you are anything like me you are impatiently waiting for Warframe: 1999 whilst simultaneously cursing the fact Excalibur Prime is permanently Vault locked. To keep us fed during our wait, Digital Extremes hosted a Double Devstream to dish out a... | Read more »
The Frozen Canvas adds a splash of colou...
It is time to grab your gloves and layer up, as Torchlight: Infinite is diving into the frozen tundra in its sixth season. The Frozen Canvas is a colourful new update that brings a stylish flair to the Netherrealm and puts creativity in the... | Read more »
Back When AOL WAS the Internet – The Tou...
In Episode 606 of The TouchArcade Show we kick things off talking about my plans for this weekend, which has resulted in this week’s show being a bit shorter than normal. We also go over some more updates on our Patreon situation, which has been... | Read more »
Creative Assembly's latest mobile p...
The Total War series has been slowly trickling onto mobile, which is a fantastic thing because most, if not all, of them are incredibly great fun. Creative Assembly's latest to get the Feral Interactive treatment into portable form is Total War:... | Read more »

Price Scanner via MacPrices.net

Early Black Friday Deal: Apple’s newly upgrad...
Amazon has Apple 13″ MacBook Airs with M2 CPUs and 16GB of RAM on early Black Friday sale for $200 off MSRP, only $799. Their prices are the lowest currently available for these newly upgraded 13″ M2... Read more
13-inch 8GB M2 MacBook Airs for $749, $250 of...
Best Buy has Apple 13″ MacBook Airs with M2 CPUs and 8GB of RAM in stock and on sale on their online store for $250 off MSRP. Prices start at $749. Their prices are the lowest currently available for... Read more
Amazon is offering an early Black Friday $100...
Amazon is offering early Black Friday discounts on Apple’s new 2024 WiFi iPad minis ranging up to $100 off MSRP, each with free shipping. These are the lowest prices available for new minis anywhere... Read more
Price Drop! Clearance 14-inch M3 MacBook Pros...
Best Buy is offering a $500 discount on clearance 14″ M3 MacBook Pros on their online store this week with prices available starting at only $1099. Prices valid for online orders only, in-store... Read more
Apple AirPods Pro with USB-C on early Black F...
A couple of Apple retailers are offering $70 (28%) discounts on Apple’s AirPods Pro with USB-C (and hearing aid capabilities) this weekend. These are early AirPods Black Friday discounts if you’re... Read more
Price drop! 13-inch M3 MacBook Airs now avail...
With yesterday’s across-the-board MacBook Air upgrade to 16GB of RAM standard, Apple has dropped prices on clearance 13″ 8GB M3 MacBook Airs, Certified Refurbished, to a new low starting at only $829... Read more
Price drop! Apple 15-inch M3 MacBook Airs now...
With yesterday’s release of 15-inch M3 MacBook Airs with 16GB of RAM standard, Apple has dropped prices on clearance Certified Refurbished 15″ 8GB M3 MacBook Airs to a new low starting at only $999.... Read more
Apple has clearance 15-inch M2 MacBook Airs a...
Apple has clearance, Certified Refurbished, 15″ M2 MacBook Airs now available starting at $929 and ranging up to $410 off original MSRP. These are the cheapest 15″ MacBook Airs for sale today at... Read more
Apple drops prices on 13-inch M2 MacBook Airs...
Apple has dropped prices on 13″ M2 MacBook Airs to a new low of only $749 in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, now available for $679 for 8-Core CPU/7-Core GPU/256GB models. Apple’s one-year warranty is included, shipping is free, and each... Read more

Jobs Board

Seasonal Cashier - *Apple* Blossom Mall - J...
Seasonal Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Seasonal Fine Jewelry Commission Associate -...
…Fine Jewelry Commission Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) Read more
Seasonal Operations Associate - *Apple* Blo...
Seasonal Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Read more
Hair Stylist - *Apple* Blossom Mall - JCPen...
Hair Stylist - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.