DEV Community

Cover image for Knock and Open Source
James Sumners for Knock

Posted on

Knock and Open Source

Knock.com is built with Open Source Software (OSS). It permeates our technology stack from the interactive website all the way through to the services and systems that power our infrastructure. We depend on OSS, and we are excited to start contributing back to our community. Doing so aligns well with a couple of our core values, which we call POPSICLE, "people first" and “open”:

  • P - passionate
  • O - open
  • P - people first
  • S - simplicity
  • I - impact
  • C - courage
  • L - learning
  • E - enjoying life

We believe in being Open with our community, to Learn from each other, and to make an Impact if we can. We deeply believe that companies relying on OSS should be contributing back to the community in any way they can. For us, that means releasing code as an organization that others may find useful, and contributing back to the projects we use. Over time, that may evolve into other sorts of contributions, but these core principles will remain the same.

In that spirit, we are pleased to announce our first open source project...

sqsiphon

sqsiphon, installable via npm install @knockaway/sqsiphon, is a library we wrote to help us improve our webhook event ingestion. Initially, we were relying on the scalable nature of AWS Lambda to handle our incoming webhooks. This worked for a fair amount of time, but as we grew, so did the number of incoming webhook events we needed to process. This resulted in Lambda overloading our data stores. To solve the problem, we built out a system that receives the webhook events and puts them into an AWS SQS FIFO queue.

As we built out this new system, we looked at the current module ecosystem to determine if anything would fit our needs to keep this queue cleared. Unfortunately, the best module we could find, sqs-consumer, did not support FIFO queues and the issues indicated they did not have any intention to do so. Therefore, we wrote sqsiphon. Our library heavily borrows from the public interface of sqs-consumer, but is implemented in a much different way. In particular, sqsiphon leverages the Node.js event loop through setImmediate to build the polling mechanism instead of relying on SQS's "long polling" feature. Additionally, sqsiphon utilizes the JavaScript prototype to reduce reliance on expensive closures. As a bonus, OpenTracing support is built-in to sqsiphon so that applications built with it can be monitored effectively. The result is a library that can poll SQS extremely quickly while requiring very little overhead.

We hope you find this library as useful as we do.

Top comments (0)