Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize phrase access speed via public ETS #19

Open
seriyps opened this issue Feb 11, 2014 · 3 comments
Open

Optimize phrase access speed via public ETS #19

seriyps opened this issue Feb 11, 2014 · 3 comments

Comments

@seriyps
Copy link

seriyps commented Feb 11, 2014

Add {read_concurrency, true} option to ETS table and lookup it directly, bypasing gen_server:call.
This may be done without any API changes.

@etnt
Copy link
Owner

etnt commented Feb 14, 2014

Lookup directly...hm I wonder if someone running gettext in a distributed setting where the server only runs on a specific node? I don't remember how Klarna (a big user of gettext) does.

@seriyps
Copy link
Author

seriyps commented Feb 14, 2014

I think, it may be optional, by setting flags in gettext_server's process dictionary like

key2str(Server, Key, Lang) ->
    case proplists:get_value(public_table, erlang:process_info(Server, dictionary)) of
        undefined ->
            gen_server:call(Server, ...);
        Tid ->
            ets:lookup(Tid, ...)
    end.

Which is quite fast and don't require any message-passing.

@etnt
Copy link
Owner

etnt commented Feb 14, 2014

I would be very cautious to add anything hidden under key2str/3 since it is really heavily called in large systems such as Klarnas. I don't like the proplists module at all, and doing a process_info call, involving another process, may have uncertain side effects (e.g being re-scheduled?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants