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

  • SEARCH
  • Home
  • 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 7882605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:19:33+00:00 2026-06-03T04:19:33+00:00

Playing and trying to see how fast node.js can serve a static file from

  • 0

Playing and trying to see how fast node.js can serve a static file from disk using apache bench

ab -r -n 10000 -c 1000 http://server:8080/loadtestfile.txt

I’ve got ulimit problem on Ubuntu 11.04 x64 VirtualBox VM on OSX Lion

(node) Hit max file limit. Increase "ulimit - n"

I can’t increase the limit anymore.

$ ulimit -n 1000000
$ limit -n 1100000
-su: ulimit: open files: cannot modify limit: Operation not permitted

Is this the right way to force node.js to reload the file from disk to serve each HTTP request? How do I increase the limit beyond 1000000?

Normal curl request works:

curl http://server:8080/loadtestfile.txt

Code

var sys = require('sys'),
http = require('http'),
fs = require('fs'),
index;

http.createServer(function(request, response) {

fs.readFile('./loadtestfile.txt', function (err, data) {

    response.writeHeader(200, {"Content-Type": "text/plain"});
    response.write(data);
    response.end();
 });

}).listen(8080);
  • 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-06-03T04:19:34+00:00Added an answer on June 3, 2026 at 4:19 am

    Ideally, your application would run within the limits given to it; it should cleanly handle accept(2) returning an error condition with errno(3) set to EMFILE or ENFILE by not trying to accept another connection until an existing connection dies.

    However, fixing the application to handle this case gracefully can be difficult; if you just want to raise your limits further to do more testing, there are two possibilities.

    • Edit /etc/security/limits.conf to raise the hard limit for your user account for the nofile limit to something much higher and then log in your user account again.

    • Do your testing in a root shell; you could either log in as root directly or use sudo -s or su to start the shell, then run the ulimit -n command from there.

    The difficulty is because raising limits requires administrative access. (When you’ve got a few hundred users on the system simultaneously, you want to keep them playing nice…)

    However, I’m going to guess that your application will also run into the system-wide maximum number of open files limit; that is configured via /proc/sys/fs/file-max. Raise that limit too, if the application complains.

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

Sidebar

Related Questions

I am playing around with Google Music. I'm trying to see if I can
So I just started playing around with android and I'm trying to see what
I'm just playing around and I'm trying to grab information from websites. Unfortunately, with
You can see what I'm trying (but failing) to do with the following code:
I am trying to display a jpg file from a server into an imageView.
I am trying to load and play a wave file using: SoundPlayer simpleSound =
I'm playing an audio clip using a UIButton that calls a method (see code
I am playing around with trying to make a simple Roguelike game to learn
I am currently playing with Qt trying to set up a small particle system.
Ive been playing around with delegates trying to learn and I ran into one

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.