Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1033961
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:18:49+00:00 2026-05-16T14:18:49+00:00

First, here’s my original question that spawned all of this . I’m using Appcelerator

  • 0

First, here’s my original question that spawned all of this.

I’m using Appcelerator Titanium to develop an iPhone app (eventually Android too). I’m connecting to CouchDB’s port directly by using Titanium’s Titanium.Network.TCPSocket object. I believe it utilizes the Apple SDK’s CFSocket/NSStream class.

Once connected, I simply write:

'GET /mydb/_changes?filter=app/myfilter&feed=continuous&gameid=4&heartbeat=30000 HTTP/1.1\r\n\r\n'

directly to the socket. It keeps it open “forever” and returns JSON data whenever the db is updated and matches the filter and change request. Cool.

I’m wondering, is it ok to connect directly to CouchDB’s socket like this, or would I be better off opening the socket to node.js instead, and maybe using this CouchDB node.js module to handle the CouchDB proxy through node.js?

My main concern is performance. I just don’t have enough experience with CouchDB to know if hitting its socket and passing faux HTTP requests directly is good practice or not. Looking for experience and opinions on any ramifications or alternate suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:18:50+00:00Added an answer on May 16, 2026 at 2:18 pm

    It’s me again. 🙂

    CouchDB inherits super concurrency handling from Erlang, the language it was written in. Erlang uses lightweight processes and message passing between those processes to achieve excellent performance under high concurrent load. It will take advantage of all cpu cores, too.

    Nodejs runs a single process and basically only does one thing at a time within that process. Its event-based, non-blocking IO approach does allow it to multitask while it waits for chunks of IO but it still only does one thing at a time.

    Both should easily handle tens of thousands of connections, but I would expect CouchDB to handle concurrency better (and with less effort on your part) than Node. And keep in mind that Node adds some latency if you put it in front of CouchDB. That may only be noticeable if you have them on different machines, though.

    Writing directly to Couch via TCPSocket is a-ok as long as your write a well-formed HTTP request that follows the spec. (You’re not passing a faux request…that’s a real HTTP request you’re sending just like any other.)

    Note: HTTP 1.1 does require you to include a Host header in the request, so you’ll need to correct your code to reflect that OR just use HTTP 1.0 which doesn’t require it to keep things simple. (I’m curious why you’re not using Titanium.Network.HTTPClient. Does it only give you the request body after the request finishes or something?)

    Anyway, CouchDB can totally handle direct connections and–unless you put a lot of effort into your Node proxy–it’s probably going to give users a better experience when you have 100k of them playing the game at once.

    EDIT: If you use Node write an actual HTTP proxy. That will run a lot faster than using the module you provided and be simpler to implement. (Rather than defining your own API that then makes requests to Couch you can just pass certain requests on to CouchDB and block others, say, for security reasons.

    Also take a look at how “multinode” works:
    http://www.sitepen.com/blog/2010/07/14/multi-node-concurrent-nodejs-http-server/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings to all! This is my first question here on stackoverflow. I have a
first question here. I'm developing a program in C# (.NET 3.5) that displays files
this is my first question here so I hope I can articulate it well
First here's what I'm using and trying to do: the minimal setup for this
First off, code-readability goes out the window for this question. I'm all for code
This is my first post here and I wanted to get some input from
Well, this is my first post here and really enjoying the site. I have
First question on here so please be nice :) I know very little about
I am new here so first of all my greetings to you I am
Here's my first question at SO. I have a internal application for my company

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.