The optimal risk allocation problem or equivalently the problem of risk sharing is the problem to allocate a risk in an optimal way to n traders endowed with risk measures ϱ1,…, ϱn. This problem has a long history in mathematical economics and insurance. In the first part of the paper we review some mathematical tools and discuss their applications to various problems on risk measures related to the allocation problem such as monotonicity properties of optimal allocations, optimal investment problems or an appropriate definition of the conditional value at risk. We then consider the risk allocation problem for convex risk measures ϱi. In general the optimal risk allocation problem is well defined only under an equilibrium condition. This condition can be characterized by the existence of a common scenario measure. We formulate a meaningful modification of the optimal risk allocation problem also for markets without assuming the equilibrium condition and characterize optimal solutions. The basic idea is to restrict the class of admissible allocations in a proper way.