[erlang-questions] gen_server bottleneck

Daniel Luna daniel@REDACTED
Fri Dec 14 17:05:01 CET 2012


On 14 December 2012 09:51, Garrett Smith <g@REDACTED> wrote:
> On Fri, Dec 14, 2012 at 8:47 AM, Garrett Smith <g@REDACTED> wrote:
>> Hi Saravanan,
>> If you're bottlenecking on CPU (all your cores are fully utilized at
>> peak load) then you need either a faster machine or you'll need to
>> distribute your application to multiple machines.
>
> I should add there a number of ways you can improve efficiency, short
> of adding hardware resources. The big win, once you understand what to
> target, is C ports (or NIFs).

But long before you start looking at either NIFs or new hardware, look
into the complexity of the code itself.  Does that expensive function
even have to be called in all cases, etc.

I guess this is my pet peeve when it comes to optimizing anything.

First you optimize for readability (often gaining speed or at least
finding issues)
Then you measure
Then you optimize the hotspots you've discovered by measuring
*Then* you can start looking into hardware or non-Erlang solutions

I've also seen situations where minor changes in the requirements have
seen the possibility to speed up code by a factor 10 so that's also a
possibility.

Cheers,

Daniel



More information about the erlang-questions mailing list