Home / Companies / Couchbase / Blog / Post Details
Content Deep Dive

Writing your own storage engine for Memcached, part 3

Blog post from Couchbase

Post Details
Company
Date Published
Author
Trond Norbye, Senior Developer, Couchbase
Word Count
751
Company Posts That Month
226
Language
English
Hacker News Points
-
Post removed?
No
Summary

The tutorial explains how to implement asynchronous operations in an engine that initially runs synchronous filesystem I/O, which limits the speed of serving client requests. By using the server API available in the `create_instance` function, it introduces asynchronous methods to prevent blocking the engine API during `get` and `store` operations. The tutorial emphasizes that the design is focused on explaining the engine API rather than optimizing efficiency, suggesting potential improvements like using a thread pool instead of creating new threads for each task due to the overhead involved. It details the process of dispatching requests to new threads, using `notify_io_complete` to inform the memcached core when operations are complete, and handling errors if they occur. The code snippets provided illustrate how to update the `fs_get` method to run asynchronously and store results, with a structure for tasks that includes engine pointers, cookies, and operation-specific data.

Trends Found in this Post

No tracked trend matches for this post yet.

Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.