[erlang-questions] Slow when using chained gen_server:call's, redesign or optimize?

Max Bourinov bourinov@REDACTED
Sat Jan 28 10:20:27 CET 2012


Instead of memcache you can use ETS which is "built in" and way faster.

Sent from my iPhone

On 28.01.2012, at 13:39, Gianfranco Alongi <gianfranco.alongi@REDACTED> wrote:

> Could you put common memory-related operations into one single gen_server?
> Does this need to be gen_server at all?
>
> You could use the synchronized serialization to generate push-back
> behaviour from your system,
> so that you do not handle a new request before it's possible - maybe
> you are already doing this,
> or not.
>
> If you really want to find the bottlenecks, you could try with fprof
> http://www.erlang.org/doc/man/fprof.html
>
> /G
>
>> / Sat, Jan 28, 2012 at 1:06 AM, God Dang <goddang@REDACTED> wrote:
>> I'm creating a system where I've ended up with alot of gen_servers that
>> provides a clean interface. When I run this under load I see that the
>> gen_server:call's is becoming a bottleneck.
>> For instance, In a handle_request I might ask an other gen_server to get me
>> a cached object, then ask the database something, then etc...
>> and in some cases I have
>> my-gen_server->cache-gen_server->memcache-client-gen_server as you see it
>> stacks up to alot of steps. I've tried to optimize with deferring gen_server
>> responses and that has given a slight performance improvement but not as
>> drastical as if I for instance bypass one gen_server instance.
>>
>> Is there a better way to go about this or some smart optimization to do? And
>> FYI, I use gen_server when I need to keep a state of a connection or
>> something so if the answer is to scrap  or reduce the number of gen_servers
>> I will need to keep those connections somewhere else.
>>
>> Thanks, Dang
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list