Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Jan 2015 09:09:34 -0500
From:      grarpamp <grarpamp@gmail.com>
To:        freebsd-performance@freebsd.org
Subject:   Fwd: [tor-dev] gettimeofday() Syscall Issues
Message-ID:  <CAD2Ti28ThH5shL3q5295Ck9SNBvJa46W6XcbbY%2BZ81YJTWeKtw@mail.gmail.com>
In-Reply-To: <20150102102036.0a52b072@schwanenlied.me>
References:  <54A43EC4.2030706@mykolab.com> <smuiogrwo2w.fsf@linuxpal.mit.edu> <9BF461F5-D6B6-4287-BE8B-87B281FE93D0@gmail.com> <20150101033733.4b295d3b@schwanenlied.me> <CAKDKvuwMyHktLnhcuz-jCOoZc58yinzraq17bbOMkwCFbFADhg@mail.gmail.com> <54A621C2.2060408@mykolab.com> <20150102102036.0a52b072@schwanenlied.me>

next in thread | previous in thread | raw e-mail | index | archive | help
--001a113b7a30ecd0d8050babe387
Content-Type: text/plain; charset=UTF-8

Some recent FreeBSD related questions in this app area.


---------- Forwarded message ----------
From: Yawning Angel <yawning@schwanenlied.me>
Date: Fri, Jan 2, 2015 at 5:20 AM
Subject: Re: [tor-dev] gettimeofday() Syscall Issues
To: tor-dev@lists.torproject.org


On Thu, 01 Jan 2015 23:42:42 -0500
Libertas <libertas@mykolab.com> wrote:

> The first two account for the bulk of the calls, as they are in the
> core data relaying logic.
>
> Ultimately, the problem seems to be that the caching is very weak. At
> most, only half of the calls to tor_gettimeofday_cached_monotonic()
> use the cache. It appears in the vomiting print statements that
> loading a single simple HTML page
> (http://www.openbsd.org/faq/ports/guide.html to be exact) will cause
> >30 gettimeofday() syscalls. You can imagine how that would
> >accumulate for an exit carrying 800 KB/s if the caching
> doesn't improve much with additional circuits.

So while optimization is cool and all, I'm not seeing why this
specifically is the underlying issue.

Each cell can contain 498 bytes of user payload.  Looking at things
simplistically this is 800 KiB/s -> 1644 cells/sec, leaving you with
approximately 608 microseconds of processing time per cell.

On my i5-4250U box, gettimeofday() takes 22 ns on Linux, and 2441 ns on
FreeBSD.  I'm not sure how accurate the FreeBSD results are as it was
in a VirtualBox VM (getpid() on the same VM takes 124 ns).  If someone
has a OpenBSD box they should benchmark gettimeofday() and see how long
the call takes.

Taking the FreeBSD case (since we know that tor works fine on Linux), a
single gettimeofday() call takes approximately, 0.39% of the per-cell
processing budget.

For reference (assuming gettimeofday() in *BSD really is this shit
performance wise), 7000 calls to gettimeofday() is 17.09 ms worth of
calls.

The clock code in tor does need love, so I wouldn't object to cleanup,
but I'm not sure it's in the state where it's causing the massive
performance degradation that you are seeing.

Regards,

--
Yawning Angel

_______________________________________________
tor-dev mailing list
tor-dev@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev

--001a113b7a30ecd0d8050babe387
Content-Type: application/pgp-signature
Content-Disposition: attachment
Content-Transfer-Encoding: base64
X-Attachment-Id: 70fb2bcf5a99c8fc_0.0.1

LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0NClZlcnNpb246IEdudVBHIHYyDQoNCmlRSWNC
QUVCQ2dBR0JRSlVwbkQwQUFvSkVQNHZrRm9JQjhCb2JnWVAvMmdJRzd3Vy9BbFVUcmhpcnVLRGV1
ZXcNCkE1ZTVoWWNzaEphTm9FL2JpSmZ6MnlPU3hnVXNqZnIzUVNicFdUYjNVaXYzRlR3UC9xbDJB
ZENMSHNXSFRYVVINClFkRjlJUWxnM1N4eXkrdVdJRzRicm5pRENrVFJVa2pEazVjcE1hOVJjTUZI
MXNIWlhCY1luY0x0eWNHdE9NcEcNCnZTcHZTSk5sZ2gwc1ZGRHEvODZ4cDduNGgzUmFmQ05NOGhF
d3ZnemdidVdzK2VuUTRFTG5HSExaZ0VjTG5STCsNCjZCalZZZXllMU11ZUlyQTFtTDRyamlVaFFZ
bUI1aFhzWGhiaVNnNmVyS1pJbGkrbmlMS1JpcEwxektDRVdtZkUNCnFxdnFDc21jWXVtMEw5eEtP
LzJVOXJaUUJxZEFwaU5xR1RxRzBGekVLTDJoa3hZSE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