Comment

Comment by seppo0010

I had no intention of making the end result useful, but I run into interesting problems.

First, I wanted to make it as pure Rust as possible. I tried to avoid UNIX specific code, and since there is no library with Windows support for asynchronous IO in Rust, I was pushed into spawning thread and blocking waiting for client data. I quickly noticed that the benchmark was way below Redis (around 60% of ops/sec with 50 clients). But then someone point out to me[1] that I was running tests in a machine with two cores, and this actually may be better for machines with multiple cores[2]. I have yet to try it out and benchmark the results.

So far Rust API was disappointing for network operations. For example, `TcpStream.read()`[3] and `TcpListener.incoming()`[4] do not have a timeout. Maybe because its development is driven for Servo and not for servers.

I have thought about doubling down on multithreading and instead of a global database lock as rsedis is using now, having one per key (or some other arbitrary partition), and having concurrent operations, which is hard to do safely in C. But I have not gotten there yet.

[1] https://github.com/jonhoo/rucache/issues/2

[2] https://github.com/jonhoo/volley/

[3] http://doc.rust-lang.org/1.0.0-beta/std/net/struct.TcpStream...

[4] http://doc.rust-lang.org/1.0.0-beta/std/net/struct.TcpListen...

parent seppo0010 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton