简体   繁体   中英

TCP receiving and sending buffersizes in node.js

I have been working with node.js for the last 4 month and now wants to increase tcp receving and sending buffersize.

My purpose is to speed up my application and expermantation with buffersizes may increase preformance.

I have searched on google but haven't found anything useful except that you can change the default socket buffersizes on linux as example on this website:

http://www.cyberciti.biz/faq/linux-tcp-tuning/

Is there any way to change/set tcp sending and receiving buffersizes for node.js io?

stream_wrap has an allocation callback passed to libuv that is passed a suggested_size of the allocated memory to use in the receiving the data. Right now it passes 64KB as the suggested size, and there's no way to change this afaik.

Is this along the line of your question?

I found the stream_wrap on git:
git... src/stream_wrap src file

And if you navigate src/stream_wrap.cc in node.js src folder and looking up following code:

    // If less than 64kb is remaining on the slab allocate a new one.
    if (SLAB_SIZE - slab_used < 64 * 1024) {
      slab = NewSlab(global, wrap->object_);
    } else {
      wrap->object_->SetHiddenValue(slab_sym, slab_obj);
    }
} 

Then you might be able to change the size.

@Trev Norris you know anything about this?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM