About how long would it be taken to do garbage collection in large memory?

57 views
Skip to first unread message

Marsha

unread,
Jul 24, 2019, 12:25:15 PM7/24/19
to v8-users
If a node application uses very large  memory (e.g., 512GB, 1024GB etc.), about how long might it be taken to do garbage collection by the latest V8?

Could V8 be trusted to run large in-memory applications?

Ben Noordhuis

unread,
Jul 25, 2019, 12:53:37 AM7/25/19
to v8-users
On Wed, Jul 24, 2019 at 6:25 PM Marsha <purp...@gmail.com> wrote:
>
> If a node application uses very large memory (e.g., 512GB, 1024GB etc.), about how long might it be taken to do garbage collection by the latest V8?
>
> Could V8 be trusted to run large in-memory applications?

Your question is poorly phrased. The garbage collector performs work
relative to the _live_ set of objects. Sweeping a 1 TB heap with only
one live object is instantaneous; sweeping a 1 GB heap with 1 million
objects is not. It's impossible to give an accurate answer without
knowing the details of your application.

purple lad

unread,
Jul 25, 2019, 11:46:57 AM7/25/19
to v8-users
I mean the case where an applications uses 1TB memory with tons of live objects. How long might it be taken for the V8 GC to work with the 1TB memory filled with tons of live objects?

The V8 blog shows some data where it might take 100~ms for a normal website (https://v8.dev/blog/concurrent-marking). But I am wondering how the performance will be for some extreme cases (i.e., 1TB heap filled with tons of live objects.)

I know it is really impossible to give an accurate answer. But I just want to get very some basic ideas and estimations for the GC performance for very huge cases. Would the GC time on main thread be milli-second, second or even minutes level?


Thank you!

Ben Noordhuis

unread,
Jul 28, 2019, 5:53:38 AM7/28/19
to v8-users
On Thu, Jul 25, 2019 at 5:47 PM purple lad <purp...@gmail.com> wrote:
>
> I mean the case where an applications uses 1TB memory with tons of live objects. How long might it be taken for the V8 GC to work with the 1TB memory filled with tons of live objects?
>
> The V8 blog shows some data where it might take 100~ms for a normal website (https://v8.dev/blog/concurrent-marking). But I am wondering how the performance will be for some extreme cases (i.e., 1TB heap filled with tons of live objects.)
>
> I know it is really impossible to give an accurate answer. But I just want to get very some basic ideas and estimations for the GC performance for very huge cases. Would the GC time on main thread be milli-second, second or even minutes level?
>
>
> Thank you!

A typical Node.js application often has 10,000s to 100,000s of live
objects. A major garbage collection cycle normally completes in under
10 milliseconds.

(In practice, most will be minor scavenges that complete in < .1 ms.)

Marsha

unread,
Jul 28, 2019, 9:33:11 AM7/28/19
to v8-users
Thank you for your information.

How likely will the time of garbage collection change when the amount of live objects increases? Could it be roughly linearly?

Let's say if 1 million live objects use 10 ms on GC, then could 10 millions live objects use 100~ms on GC?

Ben Noordhuis

unread,
Jul 29, 2019, 5:00:00 AM7/29/19
to v8-users
On Sun, Jul 28, 2019 at 3:33 PM Marsha <purp...@gmail.com> wrote:
> How likely will the time of garbage collection change when the amount of live objects increases? Could it be roughly linearly?
>
> Let's say if 1 million live objects use 10 ms on GC, then could 10 millions live objects use 100~ms on GC?

Yes, it scales roughly linearly.
Reply all
Reply to author
Forward
0 new messages