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

Session timer enhancement #257

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Session timer enhancement #257

wants to merge 15 commits into from

Conversation

pcarana
Copy link
Contributor

@pcarana pcarana commented Dec 4, 2017

Under a load test scenario, the timer used for session expiration can affect the packet translation time. When the expired sessions are being removed, assuming that there are serveral expired sessions, the spin lock used can delay the packet translation the same time that the lock spends removing sessions.

The proposal (thanks @ydahhrk) is to "independize" the session removal timer, so that its behavior can be customized. The timer will do this:

  1. Start execution every 2 seconds and try to remove 1024 expired sessions.
    1. If this is enough, keep the same time and sessions to remove.
    2. If this isn't enough, the next execution will start in 1 second and will try to remove 2048 sessions.
      1. If this is enough, the next execution will start in 2 seconds and will try to remove 1024 sessions (aka begin from the start).
      2. If this isn't enough, the next execution will start in 0.5 seconds and will try to remove 4096 sessions.
        1. And so on...

Removing expired sessions isn't as important as translating packets, but it's still something that must be done (we don't want to keep expired sessions).

fmoreno added 2 commits November 29, 2017 16:56
Due to a possible bottleneck scenario, the session timer needed to be
sepparated from the other timers in order to have control on the
execution time of such timer. The scenario is this: while the sessions
are being removed, the package translation could be delayed by the
execution of the sessions removal task. This is a massive trafic
scenario that could happen when there's a huge amount of expired
sessions to remove.
Copy link
Member

@ydahhrk ydahhrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. Mainly please move the session timer to the bib table so a busy Jool instance will not affect the others.
It would be nice to see a few numbers out of a test as well.

u64 max_session_rm;
};

static struct clean_params sess_params;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something that you might have understandably missed while reading the documentation is that a kernel can have multiple Jool instances, each of them will have a distinct BIB/session database, and each of these databases will have a separate spinlock.

If sess_params is a global variable, then all the instances will share the same "session parameters", and that means that, if one translator faces stress, it will affect the session removal limit of the other translators as well. This is not what we want, because a laggy spinlock only affects its own translator.

I believe that the session parameters should belong to the bib_table structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the parameters and the timers belong to the bib_table structure.


static void timer_function(unsigned long arg)
{
xlator_foreach(clean_state, &sess_params);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice: This is the line that causes the timer (which is global) to be run on each translator instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been removed.

timer.function = timer_function;
timer.expires = 0;
timer.data = 0;
sess_params.pend_rm = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really a bug by any means, but notice that the kernel API declares boolean identifiers which Jool can access from anywhere, so you can make pend_rm more "boolean looking" by replacing 0 and 1 by more meaningful labels.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, now the boolean labels are used.

fmoreno added 11 commits December 7, 2017 15:28
Now the timer is related to each table, therefore it doesn't affect
other instances.

The code is still a work in progress, some parameters at some functions
can be removed.
There are still some tests with warnings due to the "xlator" calls
when the session timers are removed; I've taken this as a general
warning: probably the BIB shouldn't be getting the "xlator".

I'm analizing what to do, since this is probably not the best solution
(to get the "xlator" from the BIB scope).
Copy link
Contributor Author

@pcarana pcarana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requested changes had been made in 9e214c6

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

Successfully merging this pull request may close these issues.

2 participants