ANN: New iOS build with backgrounding support

27 views
Skip to first unread message

Jens Alfke

unread,
Aug 12, 2011, 2:32:00 PM8/12/11
to mobile-c...@googlegroups.com
A new up-to-the-minute build of Couchbase Mobile for iOS is now available.

https://github.com/downloads/couchbaselabs/iOS-Couchbase/iOS-Couchbase.zip

The big news is that, thanks to Aaron, the server now restarts when the app returns to the foreground, making backgrounding possible, yay. It isn’t entirely seamless, though — the server is down for a second or two after the app reappears, and any HTTP requests made to it during that time will fail with a TCP ECONN error. The best workaround is to retry any requests that fail with that error. (I’ve just added support for that to CouchCocoa’s RESTOperation class.)

Also, Aaron says he flipped on a #define that enables Erlang SMP support, which he says is making it run faster; although YMMV depending on what device you run it on.

This also incorporates the previously-mentioned fix to the listener address, changing it to 127.0.0.1 to block connections from other hosts.

—Jens

Aaron Miller

unread,
Aug 12, 2011, 2:34:21 PM8/12/11
to mobile-c...@googlegroups.com
So far the only thing that I've confirmed goes faster is Javascript views (but they go -quite a bit faster-).

Marty Schoch

unread,
Aug 12, 2011, 2:40:47 PM8/12/11
to mobile-c...@googlegroups.com
This is great news. One question I have though, the default
configuration is to bind to an ephemeral port, and in the past I had
observed that when couch would restart it would be listening on a
different port. By itself this wasn't a problem, but there was no
easy mechanism to discover the new port. Does this affect the
restarts after going into the background?

marty

J Chris Anderson

unread,
Aug 12, 2011, 2:41:06 PM8/12/11
to mobile-c...@googlegroups.com
I've confirmed that on iPhone 4 it's not meaningfully slower than
without SMP. So I think the tradeoff is worth it for better view
performance.

J Chris Anderson

unread,
Aug 12, 2011, 2:42:00 PM8/12/11
to mobile-c...@googlegroups.com
Aaron's wired it up so that after it resumes, it tries to get the port
it used to have. If it can't get that port, currently it will exit(),
but in the future we could call the couchbaseDidStart method on the
new port in cases where we can't get the old port. Not sure what the
best option there is...

Chris

Marty Schoch

unread,
Aug 12, 2011, 2:48:29 PM8/12/11
to mobile-c...@googlegroups.com
Yeah I think that is OK for now. Depending on the kind of app you're
building, other CouchDB configuration changes may result in the port
changing so having a more general mechanism to notify may be helpful.
(If I remember correctly changing the bind address also results in the
selection of a new port)

marty

Reply all
Reply to author
Forward
0 new messages