Open medislam opened 3 years ago
Do you have numbers about this high overhead ?
I used a single probe to trace vfs_read, the overhead is up to 30% when the throughput generated by fio is close to 1.2 GB / s (with requests of 4kB). But, if I comment out the ringbuffer.submit
function, the overhead will be negligible (1%).
You should do some filtering before submitting your data to ringbuf. ringbuf use spinlock internally, this could causes lock contention. Especially when you trace a function which is expected to be called frequently.
Thank you. But I am looking for if there is a way to store/cache a set of events before sending them by the submit function in BCC ?
That depends on your use-case, you can use per-cpu map/array to accumulate data before you submit. See https://github.com/iovisor/bcc/blob/master/docs/reference_guide.md#maps
I tried, but I failed to recover the events in the user space. I haven't found how to format data
as a pointer to an array in the callback
function.
Post some code snippets here ?
Is there a method in bcc to send events in batches to user space and not event by event like the
ringbuffer.submit()
does? I would like to reduce the frequency of using the functionringbuffer.submit()
which has an overhead that becomes significant when the rate of the traced events becomes important. Thanks a lot,
Yes, you can control user-space notifications with extra flags to bpf_ringbuf_submit(). See https://github.com/torvalds/linux/blob/master/include/uapi/linux/bpf.h#L4147-L4149
Combined with bpf_ringbuf_query() you should be able to implement a flexible scheme.
Is there a method in bcc to send events in batches to user space and not event by event like the
ringbuffer.submit()
does? I would like to reduce the frequency of using the functionringbuffer.submit()
which has an overhead that becomes significant when the rate of the traced events becomes important. Thanks a lot,