Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A8962822E for ; Fri, 26 Aug 2011 17:45:26 +0000 (UTC) Received: (qmail 21238 invoked by uid 500); 26 Aug 2011 17:45:25 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 21131 invoked by uid 500); 26 Aug 2011 17:45:24 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 21123 invoked by uid 99); 26 Aug 2011 17:45:24 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2011 17:45:24 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of paul.joseph.davis@gmail.com designates 209.85.220.180 as permitted sender) Received: from [209.85.220.180] (HELO mail-vx0-f180.google.com) (209.85.220.180) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Aug 2011 17:45:17 +0000 Received: by vxh15 with SMTP id 15so4052738vxh.11 for ; Fri, 26 Aug 2011 10:44:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; bh=BUn+3KaeZpJq+1fEzJGWg8Jvys0zxm7kisO8/ihXS/w=; b=ObY2H6ZIl0FH4AHsPFTe0ClRtT04mi4FxP9ha6k86lckaQWSLT1ASx6Qm/astr8738 Zd3in+Zv9W2l6Y0AmqDVoJFfuIGZoHSDe0qpZc83TtrfcAu0UNpIjF2x+luoAsT2yaFm JAOgz04zGKbEtT1EC5LQ/1kZTt0FOnP5OqUfk= Received: by 10.52.175.130 with SMTP id ca2mr1494731vdc.235.1314380697048; Fri, 26 Aug 2011 10:44:57 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.29.1 with HTTP; Fri, 26 Aug 2011 10:44:17 -0700 (PDT) In-Reply-To: References: From: Paul Davis Date: Fri, 26 Aug 2011 12:44:17 -0500 Message-ID: Subject: Re: Emfile error To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Sockets are files too. Each HTTP connection you make will require a socket unless you reuse that the client and it has HTTP/1.1 support. Each socket opened will remain open for a bit before the kernel closes it which leads to sockets exhausting the serveres file descriptor limit. On Fri, Aug 26, 2011 at 9:17 AM, Dias, Cliff, VF-Group wrote: > Hi, > I am trying to run a load test on a couch db instance. I am peforming an > http post to insert the data to the DB, but I get an emfile error. > > I have read the FAQ and I understand that I have to increase the file > descriptor limit. > > I would like to understand why I need to do this ? I am writing to a > single database, so I would expect couch DB to recycle the connection. > > Here is the method I use to write. It is a simple method called 10000 > times. > > > public void doAdd(Data data) throws HttpException, IOException > =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0PostMethod method; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0HttpClient client =3D new HttpClient(); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0String url =3D baseURL; > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0method =3D new PostMethod(url); > > > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Gson gson =3D new > GsonBuilder().setPrettyPrinting().create(); > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0String jsonOutput =3D gson.toJson(data); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0method.setRequestBody(jsonOutput); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0method.setRequestHeader( "content-type", > "application/json"); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0long t1 =3D System.currentTimeMillis(); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0client.executeMethod(method); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0String response =3D method.getResponseBody= AsString(); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0long t2 =3D System.currentTimeMillis(); > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0System.out.println("response =3D " + respo= nse); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0System.out.println("Time =3D " + (t2-t1)); > > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0method.releaseConnection(); > > =A0 =A0 =A0 =A0} > > > Kind regards, > Cliff >