Does using a large ETS table make app restart take longer?

I was talking with someone about possibly using an in-memory database to make searching through the (±1.5 gigabyte of) data more efficient.

He asked me if I knew what impact the use of an in-memory database such as ETS would have on the startup (and therefore also restart) time of the application. I have not been able to find any information about this so far. Could someone explain to me what ETS does at startup and how much longer it will take your application to be fully started when you use it?

2 Likes

I don’t have an answer, but keep in mind that ETS & DETS can’t store more than 2GB of data =)

2GB is the limit for DETS, not ETS. ETS tables are essentially as large as you want on a 64-bit system.

3 Likes

woops, indeed :smiley:

2 Likes

Just starting ETS and creating (reasonable amounts of) tables shouldn’t take any meaningful amount of time as far as I know. If you are importing lots of data to them at startup, you need to measure how long that takes.

2 Likes

I’m a bit confused by the question. ETS tables don’t survive application restart, so the size it is on shutdown doesn’t affect its size when you restart.

If you have some process for initializing the table then that is gonna be the relevant bit as I see it. You can do it sync or aync to your application boot process depending on whether it makes any sense to have stuff running on a partially initialized table.

5 Likes

Ah, I see. I did not realize that ETS tables are ephemeral (which of course makes a lot of sense).
So: Yes, the ETS table would need to be filled with data before the application could provide most of its functionalities, so it makes sense to do this during the boot process.

Maybe this whole question is somewhat nonsensical, as startup time is obviously something that only happens once, and therefore is much less important than per-request efficiency.

4 Likes