How far ahead should you search for a faculty job? Suppose you want to obtain a faculty job at a particular time.  When should you start searching for job ads?  When are they advertised?

Answers describing different customs in different countries and disciplines are encouraged.
The field of academia is hypercompetitive due to the excess amount of PhD-students and Postdocs vs a low number of faculty positions (read this). Even people doing postdocs at top places have difficulties finding faculty positions and apart from a network also luck becomes an important factor if there are >100 applications for a faculty position.

Therefore you should start searching for a faculty position at least 2 years ahead (no, this is not a joke).