The problem of searchability in decentralized complex networks is of great importance in computer science; economy; and sociology. We present a formalism that is able to cope simultaneously with the problem of search and the congestion effects that arise when parallel searches are performed; and we obtain expressions for the average search cost both in the presence and the absence of congestion. This formalism is used to obtain optimal network structures for a system using a local search algorithm. It is found that only two classes of networks can be optimal: starlike configurations; when the number of parallel searches is small; and homogeneous-isotropic configurations; when it is large.