Performance bottleneck of Custom Behavior

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Performance bottleneck of Custom Behavior

Prakash Parmar-3
Hello All,

We have a custom behavior based on gen_server with single callback function. After profiling the code we found that invoking a callback function is taking consider amount of time. The argument of callback is record of 50 elements. Did this huge record is a problem ?

What are the VM parameters we supposed to fine tune ? Like increasing heap size to avoid GC, etc ...

Regards,
Prakash 


_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Performance bottleneck of Custom Behavior

Mikael Pettersson-5
On Wed, May 15, 2019 at 11:35 AM Prakash Parmar
<[hidden email]> wrote:
>
> Hello All,
>
> We have a custom behavior based on gen_server with single callback function. After profiling the code we found that invoking a callback function is taking consider amount of time. The argument of callback is record of 50 elements. Did this huge record is a problem ?

If this 50-element record is passed across process boundaries, then
yes you may see some performance hit.  As long as the value is simply
passed around in a single process it shouldn't cause any issue.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Performance bottleneck of Custom Behavior

I Gusti Ngurah Oka Prinarjaya
Hi,

@Prakash Parmar, @Mikael Petterson
I don't understand
did you mean like these?

something(A, B, C, D, E, ....... Param50) ->
  ok.

or

something({abc}, {def}, {ghi}, ........ {param50} ) ->
  ok.

Please enlighten me

Thank you 



Pada tanggal Rab, 15 Mei 2019 pukul 17.13 Mikael Pettersson <[hidden email]> menulis:
On Wed, May 15, 2019 at 11:35 AM Prakash Parmar
<[hidden email]> wrote:
>
> Hello All,
>
> We have a custom behavior based on gen_server with single callback function. After profiling the code we found that invoking a callback function is taking consider amount of time. The argument of callback is record of 50 elements. Did this huge record is a problem ?

If this 50-element record is passed across process boundaries, then
yes you may see some performance hit.  As long as the value is simply
passed around in a single process it shouldn't cause any issue.
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|

Re: Performance bottleneck of Custom Behavior

Raimo Niskanen-11
In reply to this post by Mikael Pettersson-5
On Wed, May 15, 2019 at 12:13:29PM +0200, Mikael Pettersson wrote:

> On Wed, May 15, 2019 at 11:35 AM Prakash Parmar
> <[hidden email]> wrote:
> >
> > Hello All,
> >
> > We have a custom behavior based on gen_server with single callback function. After profiling the code we found that invoking a callback function is taking consider amount of time. The argument of callback is record of 50 elements. Did this huge record is a problem ?
>
> If this 50-element record is passed across process boundaries, then
> yes you may see some performance hit.  As long as the value is simply
> passed around in a single process it shouldn't cause any issue.

And when you change a field in a record a new copy is created, which for a
50 element record can hurt performance both by the copying time and by the
increased load on the garbage collection.

We usually try to break down such a record into a tree structure of
records, so that an update does not require copying all elements.
--

/ Raimo Niskanen, Erlang/OTP, Ericsson AB
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions