Message from discussion
GC takes too much time when create large buffers frequentely
Received: by 10.58.247.39 with SMTP id yb7mr7774274vec.24.1352861769890;
Tue, 13 Nov 2012 18:56:09 -0800 (PST)
X-BeenThere: nodejs@googlegroups.com
Received: by 10.220.156.210 with SMTP id y18ls23977vcw.2.gmail; Tue, 13 Nov
2012 18:55:49 -0800 (PST)
Received: by 10.52.71.38 with SMTP id r6mr34486vdu.12.1352861749185;
Tue, 13 Nov 2012 18:55:49 -0800 (PST)
Date: Tue, 13 Nov 2012 18:55:48 -0800 (PST)
From: darcy <freeda...@gmail.com>
To: nodejs@googlegroups.com
Message-Id: <8e38b5f1-771b-49b6-bf86-ead8a1a5a7b8@googlegroups.com>
In-Reply-To: <CAAGLGUCbEjn4gHrLOEy0AtFscP0kjQQAtzF=t8qPpSB=Xt2qZg@mail.gmail.com>
References: <204182c9-ba7a-41b5-a3c2-1749e799b5fc@googlegroups.com>
<CAAGLGUCbEjn4gHrLOEy0AtFscP0kjQQAtzF=t8qPpSB=Xt2qZg@mail.gmail.com>
Subject: Re: [nodejs] GC takes too much time when create large buffers
frequentely
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_392_449219.1352861748524"
------=_Part_392_449219.1352861748524
Content-Type: multipart/alternative;
boundary="----=_Part_393_7304886.1352861748530"
------=_Part_393_7304886.1352861748530
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
It cannot be avoid sometimes. In my case, I need to build a new block of
binary data, then send to client. Even use C++ addon to build data, it's
still necessary to return a Buffer for network sending.
On Tuesday, November 13, 2012 6:20:43 PM UTC+8, chilts wrote:
>
> On 13 November 2012 23:09, darcy <free...@gmail.com <javascript:>> wrote:
> > So, you should be careful with large buffers.
>
> Not just careful, but try to avoid them anyway. By streaming your info
> to/from disk, to/from requests or to/from external services you'll
> avoid having to use large buffers completely. It's probably a good
> practice to get into, rather than allocating large amounts of memory
> per request.
>
> Cheers,
> Andy
>
> --
> Andrew Chilton
> e: chi...@appsattic.com <javascript:>
> w: http://appsattic.com/
> t: https://twitter.com/andychilton
>
------=_Part_393_7304886.1352861748530
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
It cannot be avoid sometimes. In my case, I need to build a new block of binary data, then send to client. Even use C++ addon to build data, it's still necessary to return a Buffer for network sending.<br><br>On Tuesday, November 13, 2012 6:20:43 PM UTC+8, chilts wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 13 November 2012 23:09, darcy <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="iBZmALNgDmAJ">free...@gmail.com</a>> wrote:
<br>> So, you should be careful with large buffers.
<br>
<br>Not just careful, but try to avoid them anyway. By streaming your info
<br>to/from disk, to/from requests or to/from external services you'll
<br>avoid having to use large buffers completely. It's probably a good
<br>practice to get into, rather than allocating large amounts of memory
<br>per request.
<br>
<br>Cheers,
<br>Andy
<br>
<br>--
<br>Andrew Chilton
<br>e: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="iBZmALNgDmAJ">chi...@appsattic.com</a>
<br>w: <a href="http://appsattic.com/" target="_blank">http://appsattic.com/</a>
<br>t: <a href="https://twitter.com/andychilton" target="_blank">https://twitter.com/<wbr>andychilton</a>
<br></blockquote>
------=_Part_393_7304886.1352861748530--
------=_Part_392_449219.1352861748524--