skip to main content
10.1145/2628136.2628144acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article
Open access

There is no fork: an abstraction for efficient, concurrent, and concise data access

Published: 19 August 2014 Publication History

Abstract

We describe a new programming idiom for concurrency, based on Applicative Functors, where concurrency is implicit in the Applicative <*> operator. The result is that concurrent programs can be written in a natural applicative style, and they retain a high degree of clarity and modularity while executing with maximal concurrency. This idiom is particularly useful for programming against external data sources, where the application code is written without the use of explicit concurrency constructs, while the implementation is able to batch together multiple requests for data from the same source, and fetch data from multiple sources concurrently. Our abstraction uses a cache to ensure that multiple requests for the same data return the same result, which frees the programmer from having to arrange to fetch data only once, which in turn leads to greater modularity.
While it is generally applicable, our technique was designed with a particular application in mind: an internal service at Facebook that identifies particular types of content and takes actions based on it. Our application has a large body of business logic that fetches data from several different external sources. The framework described in this paper enables the business logic to execute efficiently by automatically fetching data concurrently; we present some preliminary results.

References

[1]
S. Awodey. Category Theory, volume 49 of Oxford Logic Guides. Oxford University Press, 2006.
[2]
K. Claessen. A poor man's concurrency monad. J. Funct. Program., 9 (3): 313--323, May 1999.
[3]
M. Eriksen. Your server as a function. In Proceedings of the Seventh Workshop on Programming Languages and Operating Systems, PLOS '13, pages 5:1--5:7. ACM, 2013. ISBN 978-1-4503-2460-1.
[4]
W. L. Harrison. Cheap (but functional) threads. Submitted for publication, http://people.cs.missouri.edu/~harrisonwl/drafts/CheapThreads.pdf.
[5]
P. Li and S. Zdancewic. Combining events and threads for scalable network services implementation and evaluation of monadic, application-level concurrency primitives. In Proceedings of the 2007 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI '07, pages 189--199, 2007.
[6]
S. Marlow. An extensible dynamically-typed hierarchy of exceptions. In Proceedings of the 2006 ACM SIGPLAN Workshop on Haskell, Haskell '06, pages 96--106, 2006.
[7]
C. Mcbride and R. Paterson. Applicative programming with effects. J. Funct. Program., 18 (1): 1--13, Jan. 2008. ISSN 0956-7968.
[8]
E. Meijer. Reactive extensions (Rx): Curing your asynchronous programming blues. In ACM SIGPLAN Commercial Users of Functional Programming, CUFP '10, pages 11:1--11:1. ACM, 2010.
[9]
S. Peyton Jones, D. Vytiniotis, S. Weirich, and G. Washburn. Simple unification-based type inference for GADTs. In Proceedings of the Eleventh ACM SIGPLAN International Conference on Functional Programming, ICFP '06, pages 50--61. ACM, 2006.
[10]
E. Scholz. A concurrency monad based on constructor primitives, or, being first-class is not enough. Technical report, Universität Berlin, 1995.
[11]
T. Stein, E. Chen, and K. Mangla. Facebook immune system. In Proceedings of the 4th Workshop on Social Network Systems, SNS '11, pages 8:1--8:8. ACM, 2011.
[12]
W. Swierstra and T. Altenkirch. Beauty in the beast. In Proceedings of the ACM SIGPLAN Workshop on Haskell Workshop, Haskell '07, pages 25--36, 2007. ISBN 978-1-59593-674-5.
[13]
D. Syme, T. Petricek, and D. Lomov. The F# asynchronous programming model. In Practical Aspects of Declarative Languages, volume 6539 of Lecture Notes in Computer Science, pages 175--189. Springer Berlin Heidelberg, 2011.
[14]
V. Venkataramani, Z. Amsden, N. Bronson, G. Cabrera III, P. Chakka, P. Dimov, H. Ding, J. Ferris, A. Giardullo, J. Hoon, S. Kulkarni, N. Lawrence, M. Marchukov, D. Petrov, and L. Puzar. TAO: How facebook serves the social graph. In Proceedings of the 2012 ACM SIGMOD International Conference on Management of Data, SIGMOD '12, pages 791--792, 2012.
[15]
J. Vouillon. Lwt: A cooperative thread library. In Proceedings of the 2008 ACM SIGPLAN Workshop on ML, ML '08, pages 3--12. ACM, 2008.

Cited By

View all
  • (2024)Parallel Algebraic Effect HandlersProceedings of the ACM on Programming Languages10.1145/36746518:ICFP(756-788)Online publication date: 15-Aug-2024
  • (2023)Formalized High Level Synthesis with Applications to Cryptographic HardwareNASA Formal Methods10.1007/978-3-031-33170-1_20(332-352)Online publication date: 3-Jun-2023
  • (2022)Program adverbs and Tlön embeddingsProceedings of the ACM on Programming Languages10.1145/35476326:ICFP(312-342)Online publication date: 31-Aug-2022
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '14: Proceedings of the 19th ACM SIGPLAN international conference on Functional programming
August 2014
390 pages
ISBN:9781450328739
DOI:10.1145/2628136
Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 August 2014

Check for updates

Author Tags

  1. applicative
  2. concurrency
  3. data-fetching
  4. distributed
  5. haskell
  6. monad

Qualifiers

  • Research-article

Conference

ICFP'14
Sponsor:

Acceptance Rates

ICFP '14 Paper Acceptance Rate 28 of 85 submissions, 33%;
Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)254
  • Downloads (Last 6 weeks)30
Reflects downloads up to 13 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Parallel Algebraic Effect HandlersProceedings of the ACM on Programming Languages10.1145/36746518:ICFP(756-788)Online publication date: 15-Aug-2024
  • (2023)Formalized High Level Synthesis with Applications to Cryptographic HardwareNASA Formal Methods10.1007/978-3-031-33170-1_20(332-352)Online publication date: 3-Jun-2023
  • (2022)Program adverbs and Tlön embeddingsProceedings of the ACM on Programming Languages10.1145/35476326:ICFP(312-342)Online publication date: 31-Aug-2022
  • (2020)Designing a Chatbot as a Mediator for Promoting Deep Self-Disclosure to a Real Mental Health ProfessionalProceedings of the ACM on Human-Computer Interaction10.1145/33928364:CSCW1(1-27)Online publication date: 29-May-2020
  • (2020)"Learning for the Rise of China": Exploring Uses and Gratifications of State-Owned Online PlatformProceedings of the ACM on Human-Computer Interaction10.1145/33928354:CSCW1(1-25)Online publication date: 29-May-2020
  • (2019)Deferring the details and deriving programsProceedings of the 4th ACM SIGPLAN International Workshop on Type-Driven Development10.1145/3331554.3342605(27-39)Online publication date: 18-Aug-2019
  • (2018)A domain-specific language for microservicesProceedings of the 9th ACM SIGPLAN International Symposium on Scala10.1145/3241653.3241654(2-12)Online publication date: 17-Sep-2018
  • (2018)Build systems à la carteProceedings of the ACM on Programming Languages10.1145/32367742:ICFP(1-29)Online publication date: 30-Jul-2018
  • (2018)Compiling for concise code and efficient I/OProceedings of the 27th International Conference on Compiler Construction10.1145/3178372.3179505(104-115)Online publication date: 24-Feb-2018
  • (2017)Accurate reification of complete supertype information for dynamic analysis on the JVMACM SIGPLAN Notices10.1145/3170492.313606152:12(104-116)Online publication date: 23-Oct-2017
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media