Redis as clientside datastore on iOS?

2,034 views
Skip to first unread message

Jaanus

unread,
Aug 24, 2010, 2:59:27 AM8/24/10
to Redis DB
Has anybody thought about using Redis for local clientside storage in
iOS apps? Similarly to how SQLite is often used? The data structures
and performance seem to be really great, but the client libraries at
this point seem to assume a server. I don't think iOS apps can run
their own private daemons or something like that.

What would it take to remove the server piece and be able to directly
call the API from Objective-C against local storage?


J

teleo

unread,
Aug 24, 2010, 5:59:57 AM8/24/10
to Redis DB
I am also interested in the question of embedding a Redis node in a C+
+ application, and using direct APIs.

Jak Sprats

unread,
Aug 24, 2010, 2:38:26 PM8/24/10
to Redis DB
If you guys want to embed redis into a single process w/ no threads,
it is fairly simple. You can just strip out the parts that start the
server and then use the createFakeClient() API.

If you want to embed redis into a multi-threaded process, this is a
problem. redis is written to be single threaded, that is why it is so
fast, there are no locks, no latches, etc... changing the code to be
multi-threaded is most likely not going to happen (for good reasons).

InMemory Databases dont really need threads, as they dont need to wait
on I/O devices as much as Disk Based Databases. Some argue that cpus
wait on the memory wall, but Ive benchmarked this with RAM @1066 and
RAM @400MHz and it only happens in Datawarehousing loads (not OLTP
loads, what redis is designed for).

There are other issues w/ embedding redis. Since its a single process,
its best that it stay pinned to a single core to optimise L1/L2 Cache
hit ratios. If the threads accessing this are spread evenly over 4
cores, then accessing redis on core1 causes context switches and cross-
core communication ... sometimes the chip does all this w/o hiccups,
and sometimes it gets ugly.

Michael Ledford

unread,
Oct 2, 2010, 7:31:28 PM10/2/10
to Redis DB

On Aug 24, 2:59 am, Jaanus <jaa...@gmail.com> wrote:
> Has anybody thought about using Redis forlocalclientsidestoragein
> iOS apps? Similarly to how SQLite is often used? The data structures
> and performance seem to be really great, but the client libraries at
> this point seem to assume a server. I don't think iOS apps can run
> their own private daemons or something like that.

While in general this seems like a great idea I think redis would
probably be a bad idea for iOS apps. Since in redis everything must be
loaded up into memory and iOS devices are memory constrained you could
possibly run into problems.

Otherwise I agree this would be interesting addition.

Michael
Reply all
Reply to author
Forward
0 new messages