days
-1
-3
hours
0
-6
minutes
-1
-3
seconds
0
-8
search
He may not be blue, but he sure is fast.

Sonic, the lightweight search engine backend is an alternative to Elasticsearch

Sarah Schlothauer
sonic
© Shutterstock / Nadezda Murmakova

Looking for a lightweight alternative search backend to Elasticsearch? Sonic is a search backend written in Rust. It aims for a low CPU footprint and uses around 30 MB of RAM. See its speed benchmarks and its search query features. Find out how to get started.

According to the DB-Engines Ranking, Elasticsearch is currently in the top ten database management systems. Despite its popularity and usage, alternative tools exist for users who feel that Elasticsearch does not meet their specific use cases. Sonic is one of these alternatives. It is a “fast, lightweight & schema-less search backend”, runs on just a few MBs of RAM, and was written in Rust.

We recently highlighted it on our March 2019 GitHub list, where we highlight some of the GitHub repos that trended that month. Today we are giving more time for it to shine in the spotlight.

Lightweight Elasticsearch alternative

From creator Valerian Sailou’s blog, Sonic’s design philosophy comes from answering four questions:

Is this feature really needed?
How can we make it simple?
Is Sonic still fast and lightweight with it?
Is configuring Sonic getting harder with that new shiny thing?

Valerian Sailou

Passing this test allows for Sonic to remain lightweight and capable of running on low resources.

SEE ALSO: Meet Osaka, a Rust async for explicit, well-defined code that doesn’t take up too much space

The announcement blog lists some of the features:

  • Search term bucket organization.
  • Automatic spell-check and typo correction for queries.
  • Real-time word auto-complete suggestions allow for creating responsive search engines.
  • Multi-lingual text language support in the lexing system and Unicode support.
  • Sonic Channel protocol helps search your index and perform administrative actions. Use libraries to connect to Sonic Channel from your apps over LAN. Read more about Sonic channel and how it can manage your search index.
  • Coded in Rust. Rustlang provides high performance and stability.
  • Schema-less

Testing Sonic out

See the benchmarks on GitHub. Explore several scenarios to see how quickly Sonic performs. According to GitHub, its creator built Sonic to counteract the expenses of using ELS and other database tools that were too heavyweight to scale. Creating this search backend helped save money and disk space.

You can test out its speedy performance in real time. Crisp integrates Sonic for its search results and can be viewed on the help desk page. Try typing in more than two characters in the search bar and see the results populate. Both search and suggestion results use Sonic.

sonic

Search results on the Crisp Helpdesk powered by Sonic

SEE ALSO: How to supercharge Elasticsearch with Siren

Download Sonic from the release page. The latest release v1.1.9 from March 29, 2019 fixes a dead-lock, reworks a command internal, and adds two more fixes.

The official Sonic integration library is NodeJS. Community created libraries for Python, Ruby, Go, PHP, Java, and Elixir are available on GitHub.

You will need Docker and NodeJS in your test environment before starting.

Before using, familiarize yourself with its limitations to know if it fits your specific use cases. Sonic Natural Language Processing system is unable to perform at the sentence-level and only works on at the word-level. Read up on this and other limitations, including its hardware limits, on GitHub.

Future plans

Recently, creator Valerian Saliou was interviewed by Federico Carrone and Amin Arria. He discussed the inspiration behind his creation and reasoning for its architecture.

According to the interview, Valerian is ultimately planning to write extensive Markdown documentation about the inner workings behind Sonic. He plans to detail each step of a query. Track his progress on this GitHub issue.

Result-wise, it performs up to expectations. From the interview:

Our Sonic instance indexes half a billion objects (messages, articles, contacts). The compressed index is 20GB, and CPU usage under load is 10% of 1 Intel Xeon core. Sonic uses ~200MB of RAM for such a large index at worst, and 20MB when it’s cold-started. Search latency is under 1ms.

Author
Sarah Schlothauer

Sarah Schlothauer

All Posts by Sarah Schlothauer

Sarah Schlothauer is an assistant editor for JAXenter.com. She received her Bachelor's degree from Monmouth University and is currently enrolled at Goethe University in Frankfurt, Germany where she is working on her Masters. She lives in Frankfurt with her husband and cat.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of