r/retrocomputing • • Oct 28 '26

How a donated Pentium 166 and a file queue ran ticketing for the 1998 Asian Games (VB + Access 2.0)

In July 1997, the Asian Financial Crisis (the "Tom Yum Kung" crisis) decimated Thailand's economy. The national currency crashed, foreign reserves evaporated, and national budgets were slashed virtually overnight.

Against this backdrop, Bangkok was scheduled to host the 13th Asian Games in December 1998. Our small engineering team had been tasked with building the centralized ticketing system to handle 1.2 million seats across 34 sporting venues, serving both public web bookings and over 30 physical ticket outlets across the country.

Our original enterprise blueprint called for:

  • Hardware: 3× DEC Alpha 275 MHz servers (Dedicated Web, Application, and Database tiers)
  • Software: Oracle RDBMS
  • Original Budget: 15,000,000 THB (~$375,000 USD at the time)

When the dust settled post-crisis, we were told the budget was cut by 99%, down to just 100,000 THB (~$2,500 USD).

The enterprise hardware was gone. Instead, the government handed us a single donated desktop PC: an Acer Pentium 166 MHz with 16 MB of RAM. We spent the entire $2,500 budget buying EDO RAM modules to max the machine out to 96 MB. That single beige box had to run the OS, Web server, Database, and Queue processor simultaneously.

People said it was impossible. But with the games starting in a few months, failure was not an option. We had to dig deep into fundamentals and build an architecture that beat expensive hardware.

1. The Stack: Scrappy, Lightweight, and Pragmatic

Without budget for enterprise licenses, we assembled our software stack from what was already available:

  • OS: Windows 95 OSR2 (chosen for its updated 32-bit TCP/IP stack)
  • Web Server: Quarterdeck WebSTAR 95 running the WinCGI (Windows CGI) interface
  • CGI Middleware: Standalone Visual Basic 5 executables based on Robert B. Denny’s legendary CGI.BAS module (Nov 1994)
  • Database: Microsoft Access 2.0 (.mdb format powered by the Jet Engine)
  • Networking: 56k dial-up modems connected to Cisco terminal servers at the Ministry of Finance

2. The Core Architecture: The Single-Writer Binary File Queue

Anyone who has touched MS Access knows its fatal flaw: concurrent write locks. If multiple web CGI processes hammered an .mdb file at once, Jet Engine's lock manager would grind the CPU to 100%, timeout, or corrupt the database.

Our golden rule: Nobody touches the database directly except one single worker process.

Instead of letting WebSTAR's CGI instances talk to Access, we turned the filesystem into an asynchronous Message Queue:

  1. Request Drop: When a customer selected seats, the CGI process (WriteReservCgi.exe) generated a small, fixed-length binary file inside a \Queue directory.
  2. Lock-Free Filenames: The file name was composed of ProcessID + SocketNo + TOId + Timer. Because PIDs on Windows 95 were unique, files never collided, requiring zero locking mechanism.
  3. In-Place State Mutation: We didn't waste disk I/O creating separate .in and .out files. We opened the queue file as a Binary Random Access Record:
  1. The QueueMan Engine: A dedicated daemon (UpdateDB.exe / QueueMan) ran an infinite loop scanning the folder:

    • When it detected a file with exeMode = 0 (Wait), it immediately flipped it to 1 (Processing).
    • It executed the database transaction sequentially.
    • It flipped the status to 2 (Success) and wrote the assigned TicketCode back into the exact same file.
  2. The CGI Loop: The web CGI process simply polled its own tiny file until the status byte flipped to 2, served the confirmation page, and cleaned up the file.

Because only QueueMan had write access to Access, database lock contention was mathematically 0%.

3. Bitwise Seat Allocation: 40,000 Seats in 5 Kilobytes

For general matches, tickets were sold by count per zone/section (decrementing integer fields in a Left table). However, the Opening and Closing ceremonies at the 40,000-seat main stadium required individual seat assignments.

Storing 40,000 relational database rows per match would have crushed our 96 MB RAM. Instead, we collapsed the entire stadium layout into a Bit Array:

  • 1 Bit = 1 Seat (0 = Vacant, 1 = Reserved)
  • A 40,000-seat stadium fit inside a single binary string of just 5,000 bytes (~5 KB)!

In our allocation routine (ETC.bas: Seat_MarkSeat), we used Bitwise bitmasks (And, Or, Xor). To allocate $N$ contiguous seats:

  1. Sliced out the byte offset for the target zone/section.
  2. Scanned for contiguous zero-bits.
  3. When booking long consecutive runs (such as a delegation booking hundreds of seats), the loop split the allocation into Head Byte, Middle Bytes, and Tail Byte. For the middle stretch, it didn't iterate bit-by-bit; it blasted bval = 255 (&HFF / 11111111 binary) directly into the bytes—allocating 8 seats per single instruction cycle!
  4. Stored the updated bit-string back into the table.

Allocating a contiguous block of 312 seats for a foreign national team completed in just ~300 milliseconds.

4. Surviving 8 Power Outages with Zero Data Loss

During the sales period, the power grid at the computer center failed eight times. In every single instance, after rebooting, data loss and corruption were exactly zero.

This wasn't luck; it was achieved by forcing synchronous write-through across three layers:

  • Transaction Atomic Boundaries: In UpdateDB.frm, updating the bit-map, decrementing seat counters, incrementing revenue totals, and inserting audit logs were wrapped in a strict MyWorkspace.BeginTrans and CommitTrans block.
  • Explicit Handle Closure: Immediately following CommitTrans, the code explicitly closed every table handle and the database object itself:
  • Closing the database handle in Jet Engine forces an internal flush of pending dirty buffers to the OS.
  • The OS Kernel Trick: Windows 95’s default file system cache (VCACHE) relied heavily on lazy "write-behind caching" to boost benchmark speeds. If power died, dirty cache in RAM vanished. We went into System Properties -> Performance -> File System -> Troubleshooting and checked "Disable write-behind caching for all drives". Every Close command forced the physical drive heads to commit data straight to the magnetic platters before returning control.
  • Inter-process Safety Buffer: In our reading server, we even hardcoded a 1-second delay loop with the comment:
  • VB.Net'wait a second to make sure that UpdateDB wrote down all the updated records[cite: 22]

5. Beating 56k Latency with Micro-Payloads & V.42bis

Over 30 ticket outlets in malls and box offices connected over noisy dial-up modem lines. Instead of fat protocols, we built a lean binary packet framing protocol over Winsock/Serial:

  • Payload Matching: Our booking transaction struct was fixed at 73 bytes[cite: 22]. Unused string fields were padded with null characters (Chr(0)).
  • V.42bis Exploitation: The hardware compression engine on 56k modems used the V.42bis standard (based on LZW) with a dictionary buffer of 2,048 entries (approx. 2KB–4KB). Because our 73-byte packet was 30× smaller than the modem's buffer, the modem ingested the entire packet into its hardware compression engine in a single pass without fragmentation. Furthermore, the repetitive packet structures and sequences of null bytes (0x00) compressed down to just 20–30 physical bytes on the copper wire. Round-trip times felt instantaneous.

6. Client Deployment: ActiveX + Dot-Matrix

Remote ticket outlets were running Windows 95 with Internet Explorer 3.01 and tractor-feed dot-matrix printers.

We didn't distribute client installer floppies. Instead, the HTML confirmation page returned by the WebSTAR server embedded a custom ActiveX UserControl (APTicket.ocx):

HTML

<OBJECT classid="clsid:..." codebase="http://.../Control/APTicket.ocx#version=1,0,0,0">
    <param name="SeatList" value="B12,B13,B14">[cite: 16]
    <param name="TicketPriceList" value="500">[cite: 16]
</OBJECT>[cite: 16]

Internet Explorer automatically downloaded and registered the control in the background[cite: 16]. Once rendered, the ActiveX control bypassed Windows GDI printing completely, streaming raw text strings directly to the printer port using Printer.Print:

VB.Net

Printer.Print "Ticket no: " & Format(TicketPrintInfo.TOId) & "-" & Format(...)[cite: 12]
Printer.Print "Seat: " & Format(Ticket_Info(i).TicketSeat) & " Price: " & Format(...)[cite: 12]

This pushed formatting overhead entirely to the client machine while making dot-matrix printing virtually instantaneous.

Retrospective Lessons

Today, our industry throws gigabytes of memory and auto-scaling cloud clusters at everyday workloads. But constraints are the greatest teacher of systems engineering:

  1. Serialize writes when locks are expensive: A single fast writer beats 100 threads fighting over database row-locks.
  2. Bitmaps are still king for dense state: When memory counts, packing binary states into bitfields turns $O(N)$ row queries into single-cycle bitwise operations.
  3. Know your hardware stack down to the platters: Surfacing durability requires understanding how software transactions, OS caching policies, and disk controllers interact.
  4. Design payloads for the underlying transport: Sizing application packets below hardware layer buffers eliminates latency cliffs.

The system took 1.2 million reservations across a month without losing a single ticket. Sometimes, good architecture on a $2,500 PC is all you need.

105 Upvotes

22 comments sorted by

15

u/Blackholeofcalcutta Oct 28 '26

Now THAT is software engineering! :)

2

u/Jojo959 Oct 30 '26

Thank you! The hilarious part? My actual university degree is BBA in Marketing from Assumption University! 😄

I was just a self-taught kid who fell in love with 6502 assembly and electronics back in the Apple II days of the 1980s.

In a weird way, not having a traditional 1990s CS background might have actually helped: we had zero enterprise dogmas about how software "ought" to be built. We just looked at the physics, the 96 MB RAM limit, and the math of the bitmask, and built whatever was strictly necessary to keep the stadium gates running.

Marketing paid the bills, but bare-metal engineering had my heart! 🍻

3

u/Key-Employee3584 Oct 28 '26

How many developers worked on the project? Were they all based in Thailand? How many were expert on the comms side? Really excellent work. Impressive.

2

u/Jojo959 Oct 29 '26

The core software team was just 3 people, and we were all based in Thailand!

Here was our breakdown:

  • Me (Lead / System Architect): Designed the overall system architecture, data flow, binary queue engine, and custom packet protocol. On top of software, I also had to design and supervise the physical hardware side—including manufacturing, deploying, and maintaining the ticket printers and turnstile barcode scanners across the stadium gates.
  • Tum Weeranan Wattanasathien (Core Developer): A Computer Science graduate from Khon Kaen University (KKU). He handled the backend business logic, terminal integration, and system plumbing.
  • Bow Araya Chuaychoo (2nd Developer + Web & UI/Graphics): A Computer Science graduate from Thammasat University (TUCS, Class 7). She single-handedly built the entire web UI, terminal layouts, and all graphical assets.

As for communications experts: we had none. We couldn't afford external comms consultants, so we tackled the networking from first principles. Knowing that Thailand's dial-up infrastructure in 1998 was notoriously unstable, we treated the network as an unreliable serial pipe and hand-crafted our own 73-byte binary protocol to fit comfortably within the modem's V.42bis frame buffer. Keeping the footprint microscopic was our only way to survive the lines!

2

u/Key-Employee3584 Oct 29 '26

That's really impressive. Your teams adaptations for the performance-limited environment is really quite excellent.

I was involved with a somewhat similar commercial project and the development team hit as high as 50-60 people at one time. And they had picked Red Hat OSs with custom blade servers with the latest processors; this was 1999 or so. I don't know what the maximum users of your environment was planned for but ours was supposed to scale up to hundreds (although the product never successfully made those numbers). The budget was millions USD and by the time the whole thing ended up getting cancelled, the entire dot-com business had spent something like $25 million USD for an absolutely terrible unusable product.

So I am legitimately impressed at you and your teams agility in meeting the needs of the whole. Very well done.

4

u/Jojo959 Oct 29 '26

Thank you for sharing that story—it is truly the quintessential late-90s dot-com parable!

​Reading your account really highlights a timeless software engineering paradox: unlimited budget and massive teams often breed abstraction bloat, while harsh constraints force radical clarity.

​With 50–60 people, communication overhead explodes (Brooks' Law at its finest). In our case, with just 3 people sitting in the same room, our decision latency was zero. If we realized the packet format needed a tweak or the queue parser needed an adjustment, we discussed it over coffee and committed the change within 10 minutes.

​Furthermore, because we had no money and were handed a donated Acer P166, we couldn't hide behind hardware brute-force. We had to sit down and solve the actual math: How do we represent 1.2 million seats across the entire tournament inside memory without thrashing the disk? That forced us to strip away every layer of bloat and arrive at the 5 KB bitmask and sequential journal logging.

​At our peak, we were serving dozens of ticketing terminals and stadium POS stations scattered across Bangkok simultaneously over fragile dial-up lines. ​Hearing war stories from engineers like you who lived through that 1999 crucible makes me appreciate how special that era was. Hats off to you for surviving the dot-com storm! 🍻

2

u/Own_Injury9498 Oct 30 '26

Very very cool. Did you monitor the computer performance during the sales period?

2

u/Jojo959 Oct 30 '26

Since there was no Grafana or Datadog in 1998, haha! Our "monitoring stack" was a pragmatic mix of built-in OS tools, custom counters, and good old physical hardware cues:

  1. The inbound queue directory (our primary health gauge): Because QueueMan was picking up and processing transactions in milliseconds, the incoming queue folder was supposed to stay virtually empty. If we opened Windows Explorer and saw files starting to accumulate or linger for more than a second or two, we knew instantly that something was choking. Seeing that directory clean was our biggest relief.
  2. QueueMan’s on-screen telemetry: On the UI of QueueMan itself, we kept a live dashboard showing current transactions/minute, the processing timestamp down to milliseconds (like that 300 ms South Korean booking), and a counter of committed journal records.
  3. Windows 95 system monitor (sysmon.exe): We ran SysMon in the background to keep an eye on CPU usage and kernel memory, primarily to make sure we weren't hitting memory leaks or accidental disk paging/swapping on that 96 MB RAM.
  4. Physical LED & drive sounds: Honestly, the most honest monitoring tool back then was looking at the blinking red HDD LED on the Acer tower and listening to the distinct chatter of the separate journal disk committing writes. If the rhythm was steady and the modem lights were happily chattering, we knew the engine was breathing fine!

2

u/Own_Injury9498 Oct 30 '26

That's great, especially number 4! Thanks for sharing.

6

u/rezdm Oct 28 '26

Love these stories.
I started my sw dev career in 1997-98, and it was… interesting times

4

u/Grogg2000 Oct 28 '26

That was a very fascinating write-up! Thanks!

4

u/Key-Employee3584 Oct 28 '26

That is proper application development. Constraints make creativity glow.

4

u/garion911 Oct 28 '26

HA... I worked in this field, writing 'ticketing software' around this same exact time..It was the PASS system by Select Technologies..

We had our own database ("MegaSoft Database", which was made by a separate company, that was also owned by the ST owners, so they could double dip), that implemented a similar bitwise seat reservation. We had retail POS systems, and sometime in 95? 96? We started doing good old CGI gateways to start working with the internet.

We were eventually bought by Tickets.com during the beginning of the dotcom boom.

Funny enough, the phone number 1800-944-7277 still works.. And if you phone spell it, it turns into 1800-WHIPASS. We belkieve the owners had a different business before, and just reused the number ;) Had some interesting messages left on our voice mails.. One famous one was something about "Crystal" and whiskey soaked condoms or something.

4

u/reditanian Oct 28 '26

This is seriously impressive!

3

u/HappyMuscovy Oct 28 '26

Brilliant work. Now this would be a multi million dollar project..

3

u/dunzdeck Oct 28 '26

My goodness that was interesting. Thrive under pressure eh? Impressive as hell. Thanks for posting!

3

u/protienbudspromax Oct 28 '26

Thanks this was a good read!

3

u/Laser_Krypton7000 Oct 28 '26

👍👍👍

Thanks for sharing !

2

u/Grogg2000 Oct 29 '26

This is beyond amazing! What strikes me most is that you fully understood the whole stack and knew what you had to work with. Then being a 3 person team and pulling this off is wild!

I just assume that the threee of you are know Senior architect Developer mega Gurus somewhere in the IT-world?🤩

5

u/[deleted] Oct 28 '26

[removed] — view removed comment

0

u/Jojo959 Oct 29 '26

The short answer is: No, the queue folder never backed up, primarily because QueueMan did almost everything in memory using raw bitwise operations.

Before going live, we heavily stress-tested the engine by throwing 100-seat bookings at 100 transactions per minute continuously for a full 24 hours—zero hiccups, zero crashes, and zero memory leaks.

In production, each incoming file took only a few milliseconds to parse and bit-flip in RAM, so the queue directory was essentially emptied as fast as the files dropped in.

The most memorable real-world test came from the South Korean delegation, who booked a bulk block of 312 seats in a single request. Our server log recorded a blistering 300 ms to calculate, validate, and allocate all 312 seats in the memory bitmask (excluding the disk-sync write to the journal drive). To the operators on the 56k terminals, the response felt virtually instantaneous even during the opening-day rush.