The MongoDB Engineering Journal

A tech blog for builders, by builders

About the Author


	    			
Name
:
"A. Jesse Jiryu Davis"
Title
:
"Staff Engineer"
Email
:
"jesse@mongodb.com"
Twitter
:
"@jessejiryudavis"
Bio
:
"

I’m a staff engineer at MongoDB in New York City. I wrote Motor, the async MongoDB Python driver, and I’m the lead developer of the MongoDB C Driver and a member of the PyMongo team. I contribute to asyncio and Tornado. I study at the International Center for Photography and practice at the Village Zendo. You can read more about me.

"
Posts by A. Jesse Jiryu Davis
  • The Saga of Concurrent DNS in Python, and the Defeat of the Wicked Mutex Troll

    creaky old wooden chest with medieval-style engravings and a scroll depicting the history of getaddrinfo on macOS

    Tell us about the time you made DNS resolution concurrent in Python on Mac and BSD.

    No, no, you do not want to hear that story, my friends. It is nothing but old lore and #ifdefs.

    But you made Python more scalable. The saga of Steve Jobs was sung to you by a mysterious wizard with a fanciful nickname! Tell us!

    Gather round, then. I will tell you how I unearthed a lost secret, unbound Python from old shackles, and banished an ancient and horrible Mutex Troll.

    Let us begin at the beginning.


    A long time ago, in the 1980s, a coven of Berkeley sorcerers crafted an operating system. They named it after themselves: the Berkeley Software Distribution, or BSD. For generations they nurtured it, growing it and adding features. One night, they conjured a powerful function that could resolve hostnames to IPv4 or IPv6 addresses. It was called getaddrinfo. The function was mighty, but in years to come it would grow dangerous, for the sorcerers had not made getaddrinfo thread-safe.

    As ages passed, BSD spawned many offspring. There were FreeBSD, OpenBSD, NetBSD, and in time, Mac OS X. Each made its copy of getaddrinfo thread safe, at different times and different ways. Some operating systems retained scribes who recorded these events in the annals. Some did not.

    Because getaddrinfo is ringed round with mystery, the artisans who make cross-platform network libraries have mistrusted it. Is it thread safe or not? Often, they hired a Mutex Troll to stand guard and prevent more than one thread from using getaddrinfo concurrently. The most widespread such library is Python’s own socket module, distributed with Python’s standard library. On Mac and other BSDs, the Python interpreter hires a Mutex Troll, who demands that each Python thread hold a special lock while calling getaddrinfo.

    Read More
  • Investing In CS4All: Training Teachers and Helping Them Build Curricula

    Until last year, Jeremy Mellema was a history teacher. Now, he’s teaching computer programming. When I visited his class in the Bronx this month, he had 30 students with 30 MacBooks, completing exercises in Python. They had just finished a lesson on data types, and now they were tackling variables. In Jeremy’s class, the first variable assignment is:

    tupac = "Greatest of All Time!!"
    

    Computer Science for All

    A year ago, New York City mayor Bill de Blasio announced Computer Science for All, an $80 million public-private partnership. The goal is to teach computer science to every student at every public school. But first, the schools need curricula and 5000 teachers need training.

    Here at MongoDB, our VP of Education Shannon Bradshaw oversees MongoDB University, which trains IT professionals to use MongoDB. When he heard about CS4All, he wanted us to contribute. He proposed that we set aside budget for two paid fellowships, and recruit public school teachers to spend the summer with us. We would develop them as teachers, and help build curricula they could take back into schools this fall. MongoDB staff would share our expertise, our office space, our equipment, and the MongoDB software itself.

    Shannon pitched his proposal to the company like this: “As many of us know, it’s still unusual for students to encounter computer science, let alone databases, in their classrooms before entering college. I believe this absence directly contributes to the gender and racial disparity we see today across our industry.” The CS4All project improves access to these subjects for many more students in our city, and MongoDB could be part of it from the beginning.

    Read More
  • Cat-Herd's Crook: How YAML test specs improve driver conformance

    Cat illustrations by Samantha Ritter

    Image of Samantha and Jesse as cats

    At MongoDB we write open source database drivers in ten programming languages. We also help developers in our community replicate our drivers’ behavior in even more (and more exotic) languages. Ideally, all drivers behave alike; or, where they differ, the differences are written down and justified. How can we herd all these cats along the same path?

    For years we failed. Each false start at standardization left us more discouraged. But we’ve recently gained momentum on standardizing our drivers. Human-readable, machine-testable specs, coded in YAML, prove which code conforms and which does not. These YAML tests are the Cat-Herd’s Crook: a tool to guide us all in the same direction.

    Read More

Copyright © 2016 MongoDB, Inc.
Mongo, MongoDB, and the MongoDB leaf logo are registered trademarks of MongoDB, Inc.

Powered by Hugo