This is a new revision of the discovery server. Relevant changes and non-changes: - Protocol towards clients is unchanged. - Recommended large scale design is still to be deployed nehind nginx (I tested, and it's still a lot faster at terminating TLS). - Database backend is leveldb again, only. It scales enough, is easy to setup, and we don't need any backend to take care of. - Server supports replication. This is a simple TCP channel - protect it with a firewall when deploying over the internet. (We deploy this within the same datacenter, and with firewall.) Any incoming client announces are sent over the replication channel(s) to other peer discosrvs. Incoming replication changes are applied to the database as if they came from clients, but without the TLS/certificate overhead. - Metrics are exposed using the prometheus library, when enabled. - The database values and replication protocol is protobuf, because JSON was quite CPU intensive when I tried that and benchmarked it. - The "Retry-After" value for failed lookups gets slowly increased from a default of 120 seconds, by 5 seconds for each failed lookup, independently by each discosrv. This lowers the query load over time for clients that are never seen. The Retry-After maxes out at 3600 after a couple of weeks of this increase. The number of failed lookups is stored in the database, now and then (avoiding making each lookup a database put). All in all this means clients can be pointed towards a cluster using just multiple A / AAAA records to gain both load sharing and redundancy (if one is down, clients will talk to the remaining ones). GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4648
15 KiB
15 KiB
Benchmarks
How to reproduce
For a comparison run:
make bench
followed by [benchcmp](http://code.google.com/p/go/source/browse/misc/benchcmp benchcmp) on the resulting files:
$GOROOT/misc/benchcmp $GOPATH/src/github.com/gogo/protobuf/test/mixbench/marshal.txt $GOPATH/src/github.com/gogo/protobuf/test/mixbench/marshaler.txt
$GOROOT/misc/benchcmp $GOPATH/src/github.com/gogo/protobuf/test/mixbench/unmarshal.txt $GOPATH/src/github.com/gogo/protobuf/test/mixbench/unmarshaler.txt
Benchmarks ran on Revision: 11c56be39364
June 2013
Processor 2,66 GHz Intel Core i7
Memory 8 GB 1067 MHz DDR3
Marshaler
benchmark | old ns/op | new ns/op | delta |
BenchmarkNidOptNativeProtoMarshal | 2656 | 889 | -66.53% |
BenchmarkNinOptNativeProtoMarshal | 2651 | 1015 | -61.71% |
BenchmarkNidRepNativeProtoMarshal | 42661 | 12519 | -70.65% |
BenchmarkNinRepNativeProtoMarshal | 42306 | 12354 | -70.80% |
BenchmarkNidRepPackedNativeProtoMarshal | 34148 | 11902 | -65.15% |
BenchmarkNinRepPackedNativeProtoMarshal | 33375 | 11969 | -64.14% |
BenchmarkNidOptStructProtoMarshal | 7148 | 3727 | -47.86% |
BenchmarkNinOptStructProtoMarshal | 6956 | 3481 | -49.96% |
BenchmarkNidRepStructProtoMarshal | 46551 | 19492 | -58.13% |
BenchmarkNinRepStructProtoMarshal | 46715 | 19043 | -59.24% |
BenchmarkNidEmbeddedStructProtoMarshal | 5231 | 2050 | -60.81% |
BenchmarkNinEmbeddedStructProtoMarshal | 4665 | 2000 | -57.13% |
BenchmarkNidNestedStructProtoMarshal | 181106 | 103604 | -42.79% |
BenchmarkNinNestedStructProtoMarshal | 182053 | 102069 | -43.93% |
BenchmarkNidOptCustomProtoMarshal | 1209 | 310 | -74.36% |
BenchmarkNinOptCustomProtoMarshal | 1435 | 277 | -80.70% |
BenchmarkNidRepCustomProtoMarshal | 4126 | 763 | -81.51% |
BenchmarkNinRepCustomProtoMarshal | 3972 | 769 | -80.64% |
BenchmarkNinOptNativeUnionProtoMarshal | 973 | 303 | -68.86% |
BenchmarkNinOptStructUnionProtoMarshal | 1536 | 521 | -66.08% |
BenchmarkNinEmbeddedStructUnionProtoMarshal | 2327 | 884 | -62.01% |
BenchmarkNinNestedStructUnionProtoMarshal | 2070 | 743 | -64.11% |
BenchmarkTreeProtoMarshal | 1554 | 838 | -46.07% |
BenchmarkOrBranchProtoMarshal | 3156 | 2012 | -36.25% |
BenchmarkAndBranchProtoMarshal | 3183 | 1996 | -37.29% |
BenchmarkLeafProtoMarshal | 965 | 606 | -37.20% |
BenchmarkDeepTreeProtoMarshal | 2316 | 1283 | -44.60% |
BenchmarkADeepBranchProtoMarshal | 2719 | 1492 | -45.13% |
BenchmarkAndDeepBranchProtoMarshal | 4663 | 2922 | -37.34% |
BenchmarkDeepLeafProtoMarshal | 1849 | 1016 | -45.05% |
BenchmarkNilProtoMarshal | 439 | 76 | -82.53% |
BenchmarkNidOptEnumProtoMarshal | 514 | 152 | -70.43% |
BenchmarkNinOptEnumProtoMarshal | 550 | 158 | -71.27% |
BenchmarkNidRepEnumProtoMarshal | 647 | 207 | -68.01% |
BenchmarkNinRepEnumProtoMarshal | 662 | 213 | -67.82% |
BenchmarkTimerProtoMarshal | 934 | 271 | -70.99% |
BenchmarkMyExtendableProtoMarshal | 608 | 185 | -69.57% |
BenchmarkOtherExtenableProtoMarshal | 1112 | 332 | -70.14% |
benchmark | old MB/s | new MB/s | speedup |
BenchmarkNidOptNativeProtoMarshal | 126.86 | 378.86 | 2.99x |
BenchmarkNinOptNativeProtoMarshal | 114.27 | 298.42 | 2.61x |
BenchmarkNidRepNativeProtoMarshal | 164.25 | 561.20 | 3.42x |
BenchmarkNinRepNativeProtoMarshal | 166.10 | 568.23 | 3.42x |
BenchmarkNidRepPackedNativeProtoMarshal | 99.10 | 283.97 | 2.87x |
BenchmarkNinRepPackedNativeProtoMarshal | 101.30 | 282.31 | 2.79x |
BenchmarkNidOptStructProtoMarshal | 176.83 | 339.07 | 1.92x |
BenchmarkNinOptStructProtoMarshal | 163.59 | 326.57 | 2.00x |
BenchmarkNidRepStructProtoMarshal | 178.84 | 427.49 | 2.39x |
BenchmarkNinRepStructProtoMarshal | 178.70 | 437.69 | 2.45x |
BenchmarkNidEmbeddedStructProtoMarshal | 124.24 | 317.56 | 2.56x |
BenchmarkNinEmbeddedStructProtoMarshal | 132.03 | 307.99 | 2.33x |
BenchmarkNidNestedStructProtoMarshal | 192.91 | 337.86 | 1.75x |
BenchmarkNinNestedStructProtoMarshal | 192.44 | 344.45 | 1.79x |
BenchmarkNidOptCustomProtoMarshal | 29.77 | 116.03 | 3.90x |
BenchmarkNinOptCustomProtoMarshal | 22.29 | 115.38 | 5.18x |
BenchmarkNidRepCustomProtoMarshal | 35.14 | 189.80 | 5.40x |
BenchmarkNinRepCustomProtoMarshal | 36.50 | 188.40 | 5.16x |
BenchmarkNinOptNativeUnionProtoMarshal | 32.87 | 105.39 | 3.21x |
BenchmarkNinOptStructUnionProtoMarshal | 66.40 | 195.76 | 2.95x |
BenchmarkNinEmbeddedStructUnionProtoMarshal | 93.24 | 245.26 | 2.63x |
BenchmarkNinNestedStructUnionProtoMarshal | 57.49 | 160.06 | 2.78x |
BenchmarkTreeProtoMarshal | 137.64 | 255.12 | 1.85x |
BenchmarkOrBranchProtoMarshal | 137.80 | 216.10 | 1.57x |
BenchmarkAndBranchProtoMarshal | 136.64 | 217.89 | 1.59x |
BenchmarkLeafProtoMarshal | 214.48 | 341.53 | 1.59x |
BenchmarkDeepTreeProtoMarshal | 95.85 | 173.03 | 1.81x |
BenchmarkADeepBranchProtoMarshal | 82.73 | 150.78 | 1.82x |
BenchmarkAndDeepBranchProtoMarshal | 96.72 | 153.98 | 1.59x |
BenchmarkDeepLeafProtoMarshal | 117.34 | 213.41 | 1.82x |
BenchmarkNidOptEnumProtoMarshal | 3.89 | 13.16 | 3.38x |
BenchmarkNinOptEnumProtoMarshal | 1.82 | 6.30 | 3.46x |
BenchmarkNidRepEnumProtoMarshal | 12.36 | 38.50 | 3.11x |
BenchmarkNinRepEnumProtoMarshal | 12.08 | 37.53 | 3.11x |
BenchmarkTimerProtoMarshal | 73.81 | 253.87 | 3.44x |
BenchmarkMyExtendableProtoMarshal | 13.15 | 43.08 | 3.28x |
BenchmarkOtherExtenableProtoMarshal | 24.28 | 81.09 | 3.34x |
Unmarshaler
benchmark | old ns/op | new ns/op | delta |
BenchmarkNidOptNativeProtoUnmarshal | 2521 | 1006 | -60.10% |
BenchmarkNinOptNativeProtoUnmarshal | 2529 | 1750 | -30.80% |
BenchmarkNidRepNativeProtoUnmarshal | 49067 | 35299 | -28.06% |
BenchmarkNinRepNativeProtoUnmarshal | 47990 | 35456 | -26.12% |
BenchmarkNidRepPackedNativeProtoUnmarshal | 26456 | 23950 | -9.47% |
BenchmarkNinRepPackedNativeProtoUnmarshal | 26499 | 24037 | -9.29% |
BenchmarkNidOptStructProtoUnmarshal | 6803 | 3873 | -43.07% |
BenchmarkNinOptStructProtoUnmarshal | 6786 | 4154 | -38.79% |
BenchmarkNidRepStructProtoUnmarshal | 56276 | 31970 | -43.19% |
BenchmarkNinRepStructProtoUnmarshal | 48750 | 31832 | -34.70% |
BenchmarkNidEmbeddedStructProtoUnmarshal | 4556 | 1973 | -56.69% |
BenchmarkNinEmbeddedStructProtoUnmarshal | 4485 | 1975 | -55.96% |
BenchmarkNidNestedStructProtoUnmarshal | 223395 | 135844 | -39.19% |
BenchmarkNinNestedStructProtoUnmarshal | 226446 | 134022 | -40.82% |
BenchmarkNidOptCustomProtoUnmarshal | 1859 | 300 | -83.86% |
BenchmarkNinOptCustomProtoUnmarshal | 1486 | 402 | -72.95% |
BenchmarkNidRepCustomProtoUnmarshal | 8229 | 1669 | -79.72% |
BenchmarkNinRepCustomProtoUnmarshal | 8253 | 1649 | -80.02% |
BenchmarkNinOptNativeUnionProtoUnmarshal | 840 | 307 | -63.45% |
BenchmarkNinOptStructUnionProtoUnmarshal | 1395 | 639 | -54.19% |
BenchmarkNinEmbeddedStructUnionProtoUnmarshal | 2297 | 1167 | -49.19% |
BenchmarkNinNestedStructUnionProtoUnmarshal | 1820 | 889 | -51.15% |
BenchmarkTreeProtoUnmarshal | 1521 | 720 | -52.66% |
BenchmarkOrBranchProtoUnmarshal | 2669 | 1385 | -48.11% |
BenchmarkAndBranchProtoUnmarshal | 2667 | 1420 | -46.76% |
BenchmarkLeafProtoUnmarshal | 1171 | 584 | -50.13% |
BenchmarkDeepTreeProtoUnmarshal | 2065 | 1081 | -47.65% |
BenchmarkADeepBranchProtoUnmarshal | 2695 | 1178 | -56.29% |
BenchmarkAndDeepBranchProtoUnmarshal | 4055 | 1918 | -52.70% |
BenchmarkDeepLeafProtoUnmarshal | 1758 | 865 | -50.80% |
BenchmarkNilProtoUnmarshal | 564 | 63 | -88.79% |
BenchmarkNidOptEnumProtoUnmarshal | 762 | 73 | -90.34% |
BenchmarkNinOptEnumProtoUnmarshal | 764 | 163 | -78.66% |
BenchmarkNidRepEnumProtoUnmarshal | 1078 | 447 | -58.53% |
BenchmarkNinRepEnumProtoUnmarshal | 1071 | 479 | -55.28% |
BenchmarkTimerProtoUnmarshal | 1128 | 362 | -67.91% |
BenchmarkMyExtendableProtoUnmarshal | 808 | 217 | -73.14% |
BenchmarkOtherExtenableProtoUnmarshal | 1233 | 517 | -58.07% |
benchmark | old MB/s | new MB/s | speedup |
BenchmarkNidOptNativeProtoUnmarshal | 133.67 | 334.98 | 2.51x |
BenchmarkNinOptNativeProtoUnmarshal | 119.77 | 173.08 | 1.45x |
BenchmarkNidRepNativeProtoUnmarshal | 143.23 | 199.12 | 1.39x |
BenchmarkNinRepNativeProtoUnmarshal | 146.07 | 198.16 | 1.36x |
BenchmarkNidRepPackedNativeProtoUnmarshal | 127.80 | 141.04 | 1.10x |
BenchmarkNinRepPackedNativeProtoUnmarshal | 127.55 | 140.78 | 1.10x |
BenchmarkNidOptStructProtoUnmarshal | 185.79 | 326.31 | 1.76x |
BenchmarkNinOptStructProtoUnmarshal | 167.68 | 273.66 | 1.63x |
BenchmarkNidRepStructProtoUnmarshal | 147.88 | 260.39 | 1.76x |
BenchmarkNinRepStructProtoUnmarshal | 171.20 | 261.97 | 1.53x |
BenchmarkNidEmbeddedStructProtoUnmarshal | 142.86 | 329.42 | 2.31x |
BenchmarkNinEmbeddedStructProtoUnmarshal | 137.33 | 311.83 | 2.27x |
BenchmarkNidNestedStructProtoUnmarshal | 154.97 | 259.47 | 1.67x |
BenchmarkNinNestedStructProtoUnmarshal | 154.32 | 258.42 | 1.67x |
BenchmarkNidOptCustomProtoUnmarshal | 19.36 | 119.66 | 6.18x |
BenchmarkNinOptCustomProtoUnmarshal | 21.52 | 79.50 | 3.69x |
BenchmarkNidRepCustomProtoUnmarshal | 17.62 | 86.86 | 4.93x |
BenchmarkNinRepCustomProtoUnmarshal | 17.57 | 87.92 | 5.00x |
BenchmarkNinOptNativeUnionProtoUnmarshal | 38.07 | 104.12 | 2.73x |
BenchmarkNinOptStructUnionProtoUnmarshal | 73.08 | 159.54 | 2.18x |
BenchmarkNinEmbeddedStructUnionProtoUnmarshal | 94.00 | 185.92 | 1.98x |
BenchmarkNinNestedStructUnionProtoUnmarshal | 65.35 | 133.75 | 2.05x |
BenchmarkTreeProtoUnmarshal | 141.28 | 297.13 | 2.10x |
BenchmarkOrBranchProtoUnmarshal | 162.56 | 313.96 | 1.93x |
BenchmarkAndBranchProtoUnmarshal | 163.06 | 306.15 | 1.88x |
BenchmarkLeafProtoUnmarshal | 176.72 | 354.19 | 2.00x |
BenchmarkDeepTreeProtoUnmarshal | 107.50 | 205.30 | 1.91x |
BenchmarkADeepBranchProtoUnmarshal | 83.48 | 190.88 | 2.29x |
BenchmarkAndDeepBranchProtoUnmarshal | 110.97 | 234.60 | 2.11x |
BenchmarkDeepLeafProtoUnmarshal | 123.40 | 250.73 | 2.03x |
BenchmarkNidOptEnumProtoUnmarshal | 2.62 | 27.16 | 10.37x |
BenchmarkNinOptEnumProtoUnmarshal | 1.31 | 6.11 | 4.66x |
BenchmarkNidRepEnumProtoUnmarshal | 7.42 | 17.88 | 2.41x |
BenchmarkNinRepEnumProtoUnmarshal | 7.47 | 16.69 | 2.23x |
BenchmarkTimerProtoUnmarshal | 61.12 | 190.34 | 3.11x |
BenchmarkMyExtendableProtoUnmarshal | 9.90 | 36.71 | 3.71x |
BenchmarkOtherExtenableProtoUnmarshal | 21.90 | 52.13 | 2.38x |