简体   繁体   English

Node.js中的TCP接收和发送缓冲区大小

[英]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. 我在过去4个月中一直在使用node.js,现在想增加tcp接收和发送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: 我已经在Google上进行了搜索,但没有发现任何有用的信息,除了可以在以下网站上更改Linux上的默认套接字缓冲区大小:

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

Is there any way to change/set tcp sending and receiving buffersizes for node.js io? 有什么方法可以更改/设置node.js io的tcp发送和接收缓冲区大小吗?

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. stream_wrap具有传递给libuv的分配回调,该回调已传递给已分配内存的Recommendation_size,以用于接收数据。 Right now it passes 64KB as the suggested size, and there's no way to change this afaik. 目前,它以建议的大小传递64KB,无法更改此afaik。

Is this along the line of your question? 这是否符合您的问题?

I found the stream_wrap on git: 我在git上找到了stream_wrap:
git... src/stream_wrap src file git ... src / stream_wrap src文件

And if you navigate src/stream_wrap.cc in node.js src folder and looking up following code: 而且,如果您在node.js src文件夹中导航src / stream_wrap.cc并查找以下代码:

    // 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? @Trev Norris您对此一无所知吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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