A method of enrolling a joining peer (202, 402, 500) to a peer-to-peer, P2P, network, the method comprising the following actions executed by an enrolment server (204, 400, 506) associated to the P2P network: - receiving (2:2, 300) a connect request sent from the joining peer (202, 402, 500), - calculating a level of performance, of a resulting topology and a configuration of the P2P network, for different roles for the joining peer (202, 402, 500), - creating (2:6, 5:6) an enrolment recommendation for the joining peer (202, 402, 500) based on the calculation, - obtaining (2:4-2:7, 308) the enrolment recommendation for the joining peer (202, 402, 500) at least based on a stored current topology of the P2P network, wherein the enrolment recommendation indicates at least one network position and at least one role the joining peer (202, 402, 500) shall have in the P2P network, said at least one role involving at least one of one or more processing tasks and one or more storing tasks, - sending (2:9, 310, 5:7) attach information to the joining peer (202, 402, 500) according to the enrolment recommendation in response to the connect request, the attach information indicating, based on said at least one network position, where the joining peer (202, 402, 500) shall connect to the P2P network, - sending configuration information to the joining peer (202, 402, 500) indicating said at least one role involving the at least one of said one or more processing tasks and the one or more storing tasks to be performed by the joining peer (202, 402, 500) in the P2P network, and - updating (2:13, 316, 5:15) the configuration of the P2P network based on the configuration information and the stored current topology of the P2P network based on the attach information, when the joining peer (202, 402, 500) has connected to the P2P network. - receiving (2:2, 300) a connect request sent from the joining peer (202, 402, 500), - calculating a level of performance, of a resulting topology and a configuration of the P2P network, for different roles for the joining peer (202, 402, 500), - creating (2:6, 5:6) an enrolment recommendation for the joining peer (202, 402, 500) based on the calculation, - obtaining (2:4-2:7, 308) the enrolment recommendation for the joining peer (202, 402, 500) at least based on a stored current topology of the P2P network, wherein the enrolment recommendation indicates at least one network position and at least one role the joining peer (202, 402, 500) shall have in the P2P network, said at least one role involving at least one of one or more processing tasks and one or more storing tasks, - sending (2:9, 310, 5:7) attach information to the joining peer (202, 402, 500) according to the enrolment recommendation in response to the connect request, the attach information indicating, based on said at least one network position, where the joining peer (202, 402, 500) shall connect to the P2P network, - sending configuration information to the joining peer (202, 402, 500) indicating said at least one role involving the at least one of said one or more processing tasks and the one or more storing tasks to be performed by the joining peer (202, 402, 500) in the P2P network, and - updating (2:13, 316, 5:15) the configuration of the P2P network based on the configuration information and the stored current topology of the P2P network based on the attach information, when the joining peer (202, 402, 500) has connected to the P2P network.