Skip to content

Implement pcn_time_get_sec() #58

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

Open
mauriciovasquezbernal opened this issue Feb 7, 2019 · 2 comments
Open

Implement pcn_time_get_sec() #58

mauriciovasquezbernal opened this issue Feb 7, 2019 · 2 comments
Labels

Comments

@mauriciovasquezbernal
Copy link
Contributor

Some services need to get a timestamp to implement an aging mechanism. eBPF provides the bpf_ktime_get_ns helper, however we identified this function is slow in different benchmarks.

pcn-simplebride [1] and pcn-iptables [2] implement this by having a map that stores a timestamp that is updated by a thread in user-space, this solution is not ideal as each cube instance has a different thread just to update the timestamp.

This feature should be implemented directly in polycube, having a single thread for all the system to update that counter.

[1] 9a58dd3
[2] https://github.com/polycube-network/polycube/blob/master/src/services/pcn-iptables/src/modules/ConntrackTableUpdate.cpp#L110

@goldenrye
Copy link
Contributor

@mauriciovasquezbernal do we get some benchmark for bpf_ktime_get_ns() performance? I see related discussion in the thread iovisor/bcc#578, but it was closed without clear conclusion.

@sebymiano
Copy link
Collaborator

@goldenrye no, unfortunately, we do not have numbers to show but we did some experiments in the past and we noticed a slow down in the performance when that function is used.

As a consequence, we decided on some services (e.g., pcn-iptables), which do not need a nanoseconds granularity, to use a different approach with a thread that updates a counter every second (as explained in this issue) and read that counter from the eBPF program itself.

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

No branches or pull requests

3 participants