Agent based P2P Social Networks Modeling Eleonora Iotti, Agostino Poggi and Michele Tomaiuolo Dipartimento di Ingegneria dell’Informazione Università degli Studi di Parma Parma, Italy {eleonora.iotti,agostino.poggi,michele.tomaiuolo}@unipr.it Abstract — Nowadays, social networks are the most proportional to the number of users. This property is especially important means for the interaction between people on the Web. desirable for media sharing social networking systems, The large part of such networks are deployed on a centralized considering the exceptionally high amount of resources needed. architecture that allows a simple browser-based user experience Secondly, the popularity over time of most content on such and, moreover, many algorithms, e.g., friend suggestion, are far systems exhibits either a power-law or an exponential behavior easier and more efficient to implement in this setting. Peer-to- and is consequently well suited for P2P distribution [4], peer social networks do not exploit a central server for storing possibly with fallback strategies for less popular content. users' data. Therefore, their development and maintenance is Finally, enable users to have more control on their profile more difficult, but they enable users to have more control on content, ensuring a higher level of privacy and support to their profile content, ensuring a higher level of privacy. The main challenge of such a kind of network comes from guaranteeing anonymity and resilience to censorship. availability of the data of the user profiles when their owners are In a P2P social network there is no single provider but a set offline. Different solutions have been proposed, but each of them of peers that take on and share the tasks needed to run the presents advantages and drawbacks (e.g., data availability vs. system. The development of the existing functionalities of cost). In this paper we present our preliminary work on the social networks in a distributed context requires finding ways design of a peer-to-peer social network architecture that took for providing robustness against churn, distributing storage of advantage of an actor based development system for the data, propagating updates, defining an overlay topology and a modelling and analysis of a set of possible algorithms that can protocol enabling searching and addressing, etc. One of the support the availability of the profiles of the offline users in the social network. main challenge comes from guaranteeing the availability of a user profile even when she/he is offline. Some of the solutions Keywords—P2P social network; network analysis; agent rely on external storage systems, for example exploiting a based modeling and simulation; software development system; distributed file system [5], while some other more recent actor model. approaches [6][7] propose to store the profile of a user on the storage support provided by users’ friends. In these proposals, a user serves his own profile when she/he is online, and elects a I. INTRODUCTION subset of his friends to make the profile available when he is Online social networks are used by hundreds of millions of offline. people every day and play the main role in the spread of information in the Internet. Even if the social networking This paper presents an actor based development system, systems are greatly dissimilar in their user base and ActoDeS, (Actor Development System) providing a set of functionality, they are almost always centralized systems. The suitable software components for the modeling and simulation centralized nature allows a simple browser-based user of social networks and the analysis of their results and its use experience and, moreover, many algorithms, e.g., friend for the design of the architecture of a P2P social network. The suggestion, are far easier and more efficient to implement in next section introduces related work. Section 3 provides an this setting. overview of the software framework. Section 3 describes the features of such development system and shows how it makes Peer-to-Peer (P2P) define an open and decentralized easy the developing of agent based models and simulations overlay network on top of the Internet that users can use for (ABMS). Section 4 introduces our modelling and analysis directly communicating to find and share resources, often work on a set of possible algorithms for supporting the music and movie files [1]. Such networks are one of the few persistent availability of the data to the offline users of a P2P largest distributed computing systems ever, and more social network. Finally, section 6 concludes the paper by surprisingly, they can run with great stability and resilient discussing its main features and the directions for future work. performance in face of possibly the most ferocious dynamics [2]. II. RELATED WORK Thus, the use of P2P technologies for the development of social networks is not only viable, but also highly desirable [3]. A lot of work has been done for the development of agent- First of all, P2P systems essentially achieve automatic resource based software platforms that can be also used for the scalability, in the sense that the availability of resources is modelling and simulation of complex networks. Moreover, 74 several researchers propose solutions for supporting the transferred between online users in order to maximize the availability of the profiles of the offline P2P social networks. availability of users' profiles in the social network. The rest of the section presents some of the most interesting works on the previous two topics. My3 [15] is a privacy-friendly decentralized online social network that exploits some interesting features of the current Swarm [8] is the ancestor of many of the current ABMS online social networks (i.e., locality of access, predictable platforms. The basic architecture of Swarm is the simulation of access times, friends geo-localization, unique access collections of concurrently interacting agents, and this requirements of the social content, and implicit trust among paradigm is extended into the coding, including agent inspector friends. It particular, it proposes different replication strategies actions as part of the set of agents. So in order to inspect one that support users’ profile availability, access delay, freshness agent on the display, you must use another hidden, non- and storage load. interacting agent. Swarm is a stable platform, and seems particularly suited to hierarchical models. Moreover, it supports III. ACTODES good mechanisms for structure formation using multi-level feedback between agents, groups of agents, and the ActoDeS is an actor based software framework that has the environment (all treated as agents). goal of both simplifying the development of concurrent and distributed complex systems and guarantying an efficient Ascape [9] is a framework for developing and analyzing execution of applications. agent based models following some of the ideas of Swarm. However, it is somewhat easier to develop models with Ascape ActoDeS is implemented by using the Java language and than with Swarm. Indeed, its goal is to allow people with only takes advantage of preexistent Java software libraries and a little programming experience to develop quite complex solutions for supporting concurrency and distribution. ActoDeS simulations by providing a range of end user tools. Ascape is has a layered architecture composed of an application and a implemented in Java and users would require some ability to runtime layer. The application layer provides the software program in Java together with understanding of the object components that an application developer needs to extend or orientation philosophy. directly use for implementing the specific actors of an application. The runtime layer provides the software NetLogo [10] is an ABMS platform based on the Logo components that implement the ActoDeS middleware programming language. Its initial goal was to provide a high- infrastructures to support the development of standalone and level platform allowing students, down to the elementary level, distributed applications. to build and learn from simple ABMS applications. Now it offers many sophisticated capabilities and tools that make it In ActoDeS an application is based on a set of interacting suitable for complex applications too. Moreover, a big actors that perform tasks concurrently. An actor is an advantage respect to the other platforms is the simplicity of its autonomous concurrent object, which interacts with other own language. actors by exchanging asynchronous messages [16]. Moreover, it can create new actors, update its local state, change its Repast [11] is a well-established ABMS platform with behavior and kill itself. many advanced features. It started as a Java implementation of the Swarm toolkit, but rapidly expanded to provide a very full Communication between actors is buffered: incoming featured toolkit for ABMS. Although full use of the toolkit messages are stored in a mailbox until the actor is ready to requires Java programming skills, the facilities of the last process them; moreover, an actor can set a timeout for waiting implementations allow the development of simple models with for a new message and then can execute some actions if the little programming experience [12]. timeout fires. Each actor has a system-wide unique identifier called reference that allows it to be reached in a location MASON [13] is a Java ABMS tool designed to be flexible transparent way. An actor can send messages only to the actors enough to be used for a wide range of simulations, but with a of which it knows the reference, that is, the actors it created special emphasis on “swarm” simulations of a very many (up and of which it received the references from other actors. After to millions of) agents. MASON is based on a fast, orthogonal, its creation, an actor can change several times its behavior until software library to which an experienced Java programmer can it kills itself. Each behavior has the main duty of processing a easily add features for developing and simulating models in set of specific messages through a set of message handlers specific domains. called cases. Therefore, if an unexpected message arrives, then PeerSoN [6] is a prototype of P2P social network designed the actor mailbox maintains it until a next behavior will be able to provide encryption, decentralization and direct data to process it. exchange in the field of social networks. A DHT is used to An actor can be viewed as a logical thread that implements trace the user's network presence and for obtaining the index of an event loop [17][18]. This event loop perpetually processes the user's recent content. However, this DHT is logically a events that represent: the reception of messages, the behavior separate and central entity that is could become a bottleneck exchanges and the firing of timeouts. The life of an actor starts and single point of failure of the social network from the initialization of its behavior that then processes the Conti et al. [14] present a distributed storage support which received messages and the firing of message reception guarantees the users' data persistence of a social network. In timeouts. During its life, an actor can move from a behavior to their system, users dynamically elect a minimal set of point of another one more times, and its life ends when it kills itself. storage among their friends and their data are dynamically 75 ActoDeS provides different actor implementations and the messages. Moreover, to simplify the interaction between agents use of one or of another implementation represents one of the and the environment, the relevant parts of an environment are factors that mainly influence the performance of an application. represented by a set of actors whose goals are to inform the In particular, actor implementations can be divided in two agents acting in the environment about their presence and their classes: active actors, i.e., actors that have their own thread of state, and to update their state when the agents act on them. execution, and passive actors, i.e., actors that share a single Given that the behavior of such actors is similar to the one thread of execution. In this last case, the scheduler has the duty expressed by the agents acting in the environment, we call both of guaranteeing a fair execution of all the actors. agents, but we divided them in active and passive agents. Active agents are the typical agents of an ABMS, i.e., they IV. ACTODES AND ABMS APPLICATIONS represent the entities able to move and cooperate with other entities acting in the environment. Passive agents define the The features of the actor model and the flexibility of its environment of an ABMS, i.e., they represent the relevant implementation make ActoDeS suitable for building ABMS elements of the environment (e.g., in a spatial domain the applications and for analyzing the results of the related obstacles and the reference points for the movement of the simulations [19]. In particular, actors have the suitable features active agents). for defining agent models that can be used in ABMS applications and to model the computational agents found in Such agents are usually implemented taking advantage of MAS) and DAI systems. In fact, actors and computational the shared actor implementation provided by ActoDeS, but it is agents share certain characteristics: i) both react to external necessary to develop a specific scheduler. Such a scheduler stimuli (i.e., they are reactive), ii) both are self-contained, self- executes repeatedly all the agents and after each execution step regulating, and self-directed, (i.e., they are autonomous), and broadcasts them a “clock” message. This last message allows iii) both interact through asynchronous messages and such to the agents to understand that they have all the information messages are the basis for their coordination and cooperation for deciding their actions, therefore, they decide, perform some (i.e., they are social). Moreover, given that actors interact only actions and, at the end, broadcast the information about their through messages and there is not a shared state among them, it new state. is not necessary to maintain an additional copy of the In ActoDeS, all the agents are usually represented by one or environment to guarantee that agents decide their actions with more actor behaviors that process the input messages through the same information (thing that is usually necessary in some two cases. The first case processes the messages informing an application domain with other ABMS platforms). Finally, the agent about the state of the other agents. The second case use of messages for exchanging state information decouples the processes the “clock” messages. However, while active agents code of agents. In fact, agents do not need to access directly to exchange messages and perform other types of action (e.g., in a the code of the other agents to get information about them, and spatial domain to change their location), often, passive agents so the modification of the code of a type of agent should cause have the only duty of sending messages for informing the lesser modifications in the code of the other types of agent. active agents about their presence (e.g., immutable obstacles or Finally, the use of actors simplifies the development of real path points in a spatial domain). Therefore, such passive agents computational agents in domain where, for example, they need are represented by an actor behavior providing a case that get to coordinate themselves or cooperate through direct the “clock” messages for deciding when sending the interactions. information about their presence and state. Moreover, the use of ActoDeS simplifies the development Of course, different types of agent have different of flexible and scalable ABMS applications. In fact, the use of implementations of the cases of their behaviors. In particular, active and passive actors allows the development of ActoDeS provides some abstract behavior implementations for applications involving large number of actors, and the developing applications in different domains. Such availability of different schedulers and the possibility of their implementations define the state information that an agent need specialization allow a correct and efficient scheduling of the to maintain in its specific application domain and provides a set agents in application domains that require different scheduling of abstract methods for processing incoming information and algorithms [20]. Moreover, the efficient implementation of for performing the actions in response to the “clock” messages. broadcasting and multicast removes the overhead given to the need that agents must often diffuse the information about their Often the modelling of some systems (e.g., social networks) state to the other agents of the application (e.g., their location requires a massive number of agents. However, in such kind of in a spatial domain). systems, usually only a part of them is simultaneously active and the actions of the different agents do not need a A. Simulation synchronization. Therefore, it is necessary a scheduler that can manage a massive number of agents, but that can try to In large part of ABMS platforms usually a simulation is optimize the execution by scheduling only the active agents. given by a sequence of steps where each agent needs only to The solution we implemented derives from the virtual memory get information about its surround (i.e., about a subset of the techniques used by operating systems: agents increment an other agents and about the environment) and then to use such inactivity counter in the scheduling cycles in which they do not information for deciding its actions. process messages and reset it in the cycles in which they In ActoDeS the simulation is similar, but agents get process a message. The scheduler can get the value of such information about agents and the environment through counters and can move an actor in a persistent store when its 76 inactivity counter becomes greater than a fixed (or dynamic) one allows that a user gets a friend’s profile from any user of threshold. The scheduler reloads an actor from the persistent the network that is friend of the offline user, (i.e., she/he might store when it receives a new message from another agent. be not a friend of the user that require the profile). The second phase (that is not yet terminated) has the goal of measuring Of course, the number of active agents can vary over the their costs and performances of the algorithms and finding simulation, but the quality of the simulation can be guaranteed solutions for the cases in which the availability of the profiles if the number of the agents, maintained by the scheduler, of the offline users cannot be guaranteed from the simple remains in a range that depends on the available computational interaction among the online users. resources. The adopted solution, to limit to the number of active actors and to guarantee good performances, is to provide The first work of the first phase was the generation of the a scheduler able to move an inactive agent in the persistent data of a set of social networks where a thousand of users have storage on the basis of a variable number of inactive cycles. In different values of the probability for becoming friends and particular, this number is low when there is a large number of different values of probability for moving from the online to scheduled agents and high when there are few scheduled agents the offline state and vice versa. Such data was obtained through (i.e., the scheduler spends time for storing agents in the a set of simulations of the social networks where their users are persistence storage and reloading them only when there may be modelled as simple agents that are created with a set of friends memory problems for maintaining all the actors). (on the basis of the friendship probability value) and that can decide to move between the online and offline state (on the B. Data Analysis basis of the probability value assigned in the simulation). After a simulation is important to summarize and analyze the results, in a way that will yield maximum insight and help with decision-making. However, before the analysis is necessary to define the data that a simulation must provide as its result and must write the code necessary for generating such data during the simulation. ActoDeS provides a logging service that allows the recording (as serialized objects) of the information about the relevant actions of actors of the simulation (i.e., initialization, reception, sending and processing of messages, creation of actors, change of behavior, and its shutdown). In particular, such an information allows to get the state of each actor for any simulation cycle. Therefore, it is possible to analyze all the information about both the interaction among the actors and the dynamics of their state. Moreover, ActoDeS provides some tools for filtering the logging information and extracting statistical data from such information and offers a simple API to summarize the results in tables and charts. V. MODELLING P2P SOCIAL NETWORKS In the last year, our work has been mainly oriented to the analysis and simulation of social networks [21][22][23]. In particular, currently we are working on the modeling of P2P social networks [24] and we are using ActoDeS for designing a peer-to-peer social network that supports the availability of the profiles of the offline users in the social network. In fact, the problem of P2P social networks is that they do not have a centralized service that maintain the information shared among the users and so, for example, is difficult for a user that wakes up after a period of inactivity to get the last information about the users that moves to the offline state during her/his last inactivity time. Our work was divided in two phases. The first phase had the goal of measuring the level of users’ profile availability provided by the algorithms presented in [14] and in [15] and by Fig. 1. Analysis results of the two simple algorithms. two simple algorithms that replicated the users’ profile on all After that, we defined the four agent models that implement the online friends. In particular, the third algorithm allows that the four algorithms for providing users’ profile availability a user gets a friend’s profile from another friend, and the forth introduced above, then we performed the simulations, and, 77 finally, we analyzed the results. The results of the analysis Santa Fe Institute, Santa Fe, NM, USA. [Online] Available show that the two fourth algorithm provides better users’ http://www.swarm.org. profile availability that the others. Of course, the results show [9] M. T. Parker, "What is Ascape and why should you care," Journal of Artificial Societies and Social Simulation, vol. 4, no. 1, 2001. also that the level of availability of the four algorithms depends [10] S. Tisue, and U. Wilensky, “Netlogo: A simple environment for on the number of friends and on time that each user spends modeling complexity,” in Proc. Int. Conf. on Complex Systems (ICCS online. Fig. 1 show the analysis results of both the third (level 2004), 16-21, Boston, MA, USA, 2004, pp. 16-21. 0) and the fourth (level 1) algorithms for a specific set of [11] M. J. North, N. Collier, and J. Vos, “Experiences in creating three probability values. However, a complete comparison of the implementations of the repast agent modeling toolkit,” ACM Trans. on four algorithms should take into account the costs (e.g., number Modeling and Computer Simulation, vol. 16, no. 1, pp. 1-25, 2006. of replicas, transfer of the profile data, algorithms for selecting [12] M. J. North, T. R. Howe, N. T. Collier, and J. R. Vos, “The Repast the node where replicated the profile data, …) and the level of Simphony runtime system,” in Proc. Conf. on Generative Social reliability provided by the four algorithms. We are in the Processes, Models, and Mechanisms, Chicago, IL, USA, 2005 middle of this activity and we hope to have the possibility to [13] S. Luke, C. Cioffi-Revilla, L. Panait, K. Sullivan, and G. Balan, “MASON: A multiagent simulation environment,” Simulation, vol. 81, present the results in the next future. no. 7, pp. 517-527, 2005. [14] M. Conti, A. De Salve, B. Guidi, F. Pitto, and L. Ricci, "Trusted dynamic storage for dunbar-based P2P online social networks," In Prpc. VI. CONCLUSIONS OTM Int. Conf. on the Move to Meaningful Internet Systems, Berlin, This paper presented a software development system, Germany: Springer, 2014, pp. 400-417. ActoDeS, (Actor Development System) that offers a set of [15] R. Narendula, T. G. Papaioannou and K. Aberer, “A decentralized online social network with efficient user-driven replicatio,” in Proc. Int. suitable software components for the modeling and simulation Conf. on Social Computing, Amsterdam, The Netherlands: IEEE, 2012, of social networks and the analysis of their results. pp. 166-175. ActoDeS is implemented by using the Java language and is [16] G.A. Agha, “Actors: A Model of Concurrent Computation in Distributed Systems,” Cambridge, MA, USA: MIT Press, 1986. an evolution of CoDE [25] that simplifies the definition of [17] J. Dedecker, T. Van Cutsem, S. Mostinckx, T. D’Hondt and W. De actor behaviors and provides more scalable and performant Meuter, “Ambient-oriented programming in ambienttalk,” in ECOOP implementations. Moreover, it takes advantages of some 2006 – Object-Oriented Programming, Berlin, Germany: Springer, 2006, implementation solutions used in JADE [26] for the definition pp. 230-254. of some internal components. [18] M. S. Miller, E. D. Tribble, and J. Shapiro, “Concurrency among strangers,” in Trustworthy Global Computing, Berlin, Germany: Current and future research activities are and will be Springer, 2005, pp. 195-229. dedicated to complete the analysis of the algorithms for [19] A. Poggi, “Agent based modeling and simulation with ActoMoS,” in supporting the availability of offline users’ profiles and to start Proc. 16th Workshop on From Object to Agents (WOA 2015), Naples; the analysis of the possible techniques to provide a good level Italy, 2015, pp. 91-96. of security in P2P social networks [27][28] and use the same [20] P. Mathieu, and Y Secq, “Environment Updating and Agent Scheduling techniques for the design of computer-supported cooperative Policies in Agent-based Simulators,” in Proc. 4th Int. Conf. on Agents and Artificial Intelligence, Algarve, Portugal, 2012, pp. 170-175. work systems [28]. [21] F. Bergenti, E. Franchi, and A. Poggi,. “Selected models for agent-based simulation of social networks,” in Proc. 3rd Symp. on Social Networks REFERENCES and Multiagent Systems (SNAMAS 2011), York, UK. 2011, pp. 27-32. [1] R. Schollmeier, “A definition of peer-to-peer networking for the [22] F. Bergenti, E. Franchi and A. Poggi, “Agent-based interpretations of classification of peer-to-peer architectures and applications,” in Proc. 1st classic network models,” Computational and Mathematical Organization Int. Conf. on Peer-to-Peer Computing Linköping, Sweden, 2001, pp. Theory, Vol. 19, No. 2, 2013, pp. 105-127, 2013. 101-102. [23] E. Franchi, A. Poggi, and M. Tomaiuolo. "Open social networking for [2] D. Qiu, and R. Srikant, “Modeling and performance analysis of online collaboration," International Journal of e-Collaboration, vol. 9, BitTorrent-like peer-to-peer networks,” ACM SIGCOMM Computer no. 3, pp. 50-68, 2013. Communication Review, Vol. 34, No. 4, pp. 367-378, 2004. [24] E. Franchi, A. Poggi and M. Tomaiuolo, “Blogracy: A Peer-to-Peer [3] F. Wang, Y. Moreno and Y. Sun, “Structure of peer-to-peer social Social Network,” International Journal of Distributed Systems and networks,” Physical Review E, Vol. 73, No. 3, pp. 1-8, 2006. Technologies, Vol. 7, No. 2, pp.37-56, 2016. [4] M. Zink, K. Suh, Y. Gu and J. Kurose, “Characteristics of YouTube [25] F. Bergenti, A. Poggi, and M. Tomaiuolo, "An Actor Based Software network traffic at a campus network - Measurements, models, and Framework for Scalable Applications," in Internet and Distributed implications,” Computer Networks, Vol. 53, No. 4, pp. 501-514, 2009. Computing Systems, Berlin, Germany: Springer, 2014, pp. 26-35. [5] I. Clarke, O. Sandberg, B. Wiley and T. Hong, T. “Freenet: A distributed [26] A. Poggi, M. Tomaiuolo, and P. Turci, “Extending JADE for agent grid anonymous information storage and retrieval system,” in Designing applications,” in Enabling Technologies: Infrastructure for Collaborative Privacy Enhancing Technologies, LNCS, Vol. 2009, Berlin, Germany: Enterprises, Modena, Italy: IEEE, 2004, pp. 352-357. Springet, 2001, pp. 46–66. [27] A. Poggi, M. Tomaiuolo and G. Vitaglione, “A Security Infrastructure [6] S. Buchegger, D. Schiöberg, L. Vu, A. Datta, “PeerSoN: P2P social for Trust Management in Multi-agent Systems,” in Trusting Agents for networking: early experiences and insights,” in Proc 2nd ACM EuroSys Trusting Electronic Societies, Theory and Applications in HCI and E- Workshop on Social Network Systems, Nuremberg, Germany: ACM, Commerce, Berlin, Germany: Springer, 2005, pp. 162-179. 2009, pp. 46–52. [28] E. Franchi, A. Poggi, and M. Tomaiuolo, “Information and password [7] R. Baden, A. Bender, N. Spring, B. Bhattacharjee and D. Starin, attacks on social networks: An argument for cryptography,” Journal of “Persona: an online social network with user-defined privacy,” in Proc. Information Technology Research (JITR), Vol. 8, No. 1, 2015, pp.25-42. Conf. on Data Communication Barcellona, Spain, 2009, pp. 135-146. [29] F. Bergenti and A. Poggi. "An agent-based approach to manage [8] N. Minar, R. Burckhart, C. Langton, and V. Askenasi, 1996. “The negotiation protocols in flexible CSCW systems," in Proc. 4th Int. Conf. Swarm simulation system: a toolkit for building multi-agent systems,” on Autonomous agents, ACM, 2000, pp. 267-268. 78