sdf@xxxxxxxxxx <sdf@xxxxxxxxxx> [Tue, 2020-05-05 09:02 -0700]: > On 05/04, Andrey Ignatov wrote: > > Stanislav Fomichev <sdf@xxxxxxxxxx> [Mon, 2020-05-04 10:34 -0700]: > > > We want to have a tighter control on what ports we bind to in > > > the BPF_CGROUP_INET{4,6}_CONNECT hooks even if it means > > > connect() becomes slightly more expensive. The expensive part > > > comes from the fact that we now need to call inet_csk_get_port() > > > that verifies that the port is not used and allocates an entry > > > in the hash table for it. > > > FWIW: Initially that IP_BIND_ADDRESS_NO_PORT limitation came from the > > fact that on my specific use-case (mysql client making 200-500 connects > > per sec to mysql server) disabling the option was making application > > pretty much unusable (inet_csk_get_port was taking more time than mysql > > client connect timeout == 3sec). > > > But I guess for some use-cases that call sys_connect not too often it > > makes sense. > Yeah, I don't think we plan to reach those QPS numbers. > But, for the record, did you try to bind to a random port in that > case? And did you bail out on error or did a couple of retries? Random port. As for retries: no retries on low-level (no reconnecting to that same server if sys_connect failed), but I don't quite remember how higher-level behaved (it was choosing a server to connect to according to some sharding scheme and I don't remember whether it was trying to connect to next replica or not if current replica failed), sorry. -- Andrey Ignatov