Author's words of wisdom

The task of forecasting traffic

When making banner advertising solution, it’s very important to provide advertisers with the possibility of campaign forecasting. This kind of forecast lets the user know:

  1. If it’s possible to return the necessary number of impressions in a planned period
  2. Potential banner placement for a given advertising space with given targeting conditions.

Practically all modern advertising platforms (Google, AdWords, OpenX, Yandex.Direct) provide forecasts, although usually without mentioning the quality of the forecast. We will speak in more detail about how a forecast system can be built and what the factors influence the quality of the forecast.

A typical forecast system uses a cumulative advertising-space statistics system as a starting point.

Writing a convenient and decent-looking wrapper for working with transactions is a favorite pastime for many developers. Transactions must be able to start, finish and rollback properly, and they can also be nested. Python is a multifaceted language (or, as speechwriters say, “Multi-paradigm”), giving us innumerable ways of doing it.

As a foundation, I usually use Python DB API (namely, psycopg2 module). The API itself is rather low-level and is crying for improvement. What can be done?

Initially, let’s just make an ordinary decorator for opening and closing a transaction:

In life, it’s always more complicated to display and process digital video than digital photo:

  • Video content takes up much more space.
  • Manipulating videos (compression, scaling, recoding) requires far more resources than converting photos.
  • Due to its size, video traffic far surpasses that of all other resources and still requires good bandwidth.

Typical video hosting (like YouTube) allows for:

  • Video uploading
  • Videos to be shown in different sizes/formats

However, making video uploads fast and efficient, like photos on Flickr, just doesn’t work. Hosts never save original videos, and to properly display them, it’s necessary to convert (transcode) the video to different formats: for Flash-players, mobile phones, iPhone/Android, etc. This transcoding requires a lot of processing time. This is why all video hosts have a queue, where uploaded videos await processing.