Youtube’s Migration From Php to Python, Brief Technical History

Contrary to widespread belief, YouTube was 1st designed with PHP once it started, and not Python. It later on got replaced by Python in a piece-meal migration in three months when its public launch, using the mod_python Apache module and very likely the mpservlets framework.

YouTube was created in 2005 and launched in public in november that year. On the Wayback Machine, the primary entry which will be found is YouTube – Broadcast Yourself. (Apr 28, 2005), and you’ll be able to see from the page supply that a lot of of the pages were of the form index.php, watch.php, etc. If you search Google for “youtube.com/watch.php”, you will even be able to realize several legacy permalinks to it URL. Whereas this could be emulated with Python controllers/handlers/servlets, it’s high unlikely an elaborate ruse.

The first design diagram and mention of YouTube’s tech stack is from this presentation someday in 2008 by mike solomon of YouTube. In his slide deck, there was a diagram of their tech stack by Jan 2006, that showed a non-PHP stack, using Apache httpd and mod_python.

Super sizing Youtube with Python

Using the Wayback Machine links on top of, you’ll be able to quickly binary search and find that the primary “servlets” most likely started arriving after the oct 26, 2005, for subscription_center and pl_manager, likely as a part of the new nice features introduced: Subscriptions and Playlists. (The crawls by the Wayback Machine generally are missing from many dates, and those area unit normally because of periods of instability when the service may well be undergoing some larger changes causing the crawl failures, so these dates may be used as fast hints.)

It looks the complete migration occurred someday between January eighteen and January twenty six, 2006, where even the previous endpoints like my_videos.php and my_messages.php were replaced by their servlet equivalents directly. once more the period of the many days without a successful crawl would possibly recommend some instability throughout the migration process as new bottlenecks or problems are found.

After this final full migration, YouTube should have landed on the design mentioned in the slide deck above.

The possibilities for what YouTube might have been using behind mod_python are pretty restricted. Given that both CherryPy and Django were comparatively heavyweight framework with their own ORMs, it’d have been pretty exhausting to migrate over from PHP to them in a piece-meal fashion. the worth of these frameworks would are greatly diminished. They were also early in their lifecycle, still in beta and hot on the heels of Ruby on Rails.

That leaves Python Server Pages (PSP) and mod_python servlets (mpservlets), both of that had been around since at least 2004. PSP as being comparatively unstable at the time, so YouTube should have landed on the latter. Another hint is that in the slide deck, it’s mentioned that the business logic was being served inside “servlets”. Of all the online frameworks at the time, i think only mpservlets used that term.