Continuation Complexity: A Callback Hell for Distributed Systems

  • Edgar Zamora-GómezEmail author
  • Pedro García-López
  • Rubén Mondéjar
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9523)


Designing and validating large-scale distributed systems is still a complex issue. The asynchronous event-based nature of distributed communications makes these systems complex to implement, debug and test. In this article, we introduce the continuation complexity problem, that arises when synchronous invocations must be converted to asynchronous event code. This problem appears in most Actor libraries where communication is mainly asynchronous, and where a synchronous call to other Actor would block the current Actor, precluding the processing of incoming messages.

We propose here a novel parallel invocation abstraction that considerably simplifies the continuation complexity problem for distributed actor systems requiring non-blocking synchronous invocations. Our parallel abstraction extends the message passing concurrency model to support concurrent interleavings of method executions within a single Actor. We present here two candidate solutions for implementing such parallel calls: one based on threads and locking, and other based on green threads and continuations.

We evaluated the simplicity of our solution implementing a well known distributed algorithm like Chord (ring-based structured overlay). We compare our Actor implementation of Chord with three different simulators (PeerSim, PlanetSim, Macedon). This validation demonstrates that our approach is superior in simplicity (less LoC) and complexity (less McAbe complexity), envisaging its great potential for distributed systems scenarios.


Actor model Object actors Continuation complexity 



Special thanks to Douglas C. Schmidt for his helpful comments about the Active Object pattern.

This work has been partially funded by the EU in the context of the project CloudSpaces (FP7-317555) and by the Spanish Ministerio de Ciencia e Innovación in the project Cloud Services and Community Clouds (TIN2013-47245-C2-2-R)


  1. 1.
    .NET platform Async and Await abstractions.
  2. 2.
    Agha, G.: Actors: a model of concurrent computation. In: Distributed Systems. Artificial Intelligence. The MIT Press, Cambridge (1986)Google Scholar
  3. 3.
    Bainomugisha, E., Carreton, A.L., van Cutsem, T., Mostinckx, S., de Meuter, W.: A survey on reactive programming. ACM Comput. Surv. 45(4), 52:1–52:34 (2013). CrossRefGoogle Scholar
  4. 4.
    Edwards, J.: Coherent reaction. In: Proceedings of the 24th ACM SIGPLAN Conference Companion on Object Oriented Programming Systems Languages and Applications, pp. 925–932. ACM (2009)Google Scholar
  5. 5.
    García, P., Pairot, C., Mondéjar, R., Pujol, J., Tejedor, H., Rallo, R.: PlanetSim: a new overlay network simulation framework. In: Gschwind, T., Mascolo, C. (eds.) SEM 2004. LNCS, vol. 3437, pp. 123–136. Springer, Heidelberg (2005) CrossRefGoogle Scholar
  6. 6.
    Lin, Y., Radoi, C., Dig, D.: Retrofitting concurrency for android applications through refactoring. In: Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering, FSE 2014, pp. 341–352. ACM, New York (2014).
  7. 7.
    Montresor, A., Jelasity, M.: PeerSim: a scalable P2P simulator. In: Proceedings of the 9th International Conference on Peer-to-Peer (P2P 2009), Seattle, WA, pp. 99–100, September 2009Google Scholar
  8. 8.
    Okur, S., Hartveld, D.L., Dig, D., van Deursen, A.: A study and toolkit for asynchronous programming in c#. In: Proceedings of the 36th International Conference on Software Engineering, ICSE 2014, pp. 1117–1127. ACM, New York (2014).
  9. 9.
    Reynolds, J.: The discoveries of continuations. Lisp Symbolic Comput. 6(3–4), 233248 (1993). Special Issue on Continuations, Hingham, MA, USAGoogle Scholar
  10. 10.
    Rodriguez, A., Killian, C., Bhat, S., Kostic, D., Vahdat, A.: Macedon: methodology for automatically creating, evaluating, and designing overlay networks. In: Proceedings of the 1st Conference on Symposium on Networked Systems Design and Implementation, vol. 1, pp. 267–280 (2004)Google Scholar
  11. 11.
    Stoica, I., Morris, R., Karger, D., Kaashoek, M.F., Balakrishnan, H.: Chord: a scalable peer-to-peer lookup service for internet applications. ACM SIGCOMM Comput. Commun. Rev. 31, 149–160 (2001). ACMCrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2015

Authors and Affiliations

  • Edgar Zamora-Gómez
    • 1
    Email author
  • Pedro García-López
    • 1
  • Rubén Mondéjar
    • 1
  1. 1.Department of Computer Engineering and MathematicsUniversitat Rovira i VirgiliTarragonaSpain

Personalised recommendations