Performance of distributed applications largely depends on the mapping of their components on the underlying architecture. On one mponent-based approaches provide an abstraction suitable for development, but on the other side, actual hardware becomes every day more complex and heterogeneous. Despite this increasing gap, mapping components to processors and networks is commonly done manually and is mainly a matter of expertise. Worse, the amount of efforts required for this task rarely allows to further consider optimal hardware use or sensitivity analysis of data scaling. In this paper, we rely on a formal and experimentally sound model of performance and propose a constraint programming based framework to find consistent and efficient mappings of an application onto an architecture. Experiments show that an optimal mapping for a medium-sized application can be found in a few seconds.