Skip to content

Commit fc231a8

Browse files
committed
updated README, added license
1 parent 5307c19 commit fc231a8

File tree

4 files changed

+277
-17
lines changed

4 files changed

+277
-17
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[package]
22
name = "countserver"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
authors = ["Bart Massey <[email protected]>"]
55
edition = "2021"
6+
license-file = "LICENSE.txt"
67

78
[dependencies]
89
futures = "0.3.21"

LICENSE.txt

+223
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
Copyright © <year> <author>
2+
3+
[This program is licensed under the "Copyleft Next License version 0.3.1"]
4+
5+
Release date: 2016-04-29
6+
7+
1. License Grants; No Trademark License
8+
9+
Subject to the terms of this License, I grant You:
10+
11+
a) A non-exclusive, worldwide, perpetual, royalty-free, irrevocable
12+
copyright license, to reproduce, Distribute, prepare derivative works
13+
of, publicly perform and publicly display My Work.
14+
15+
b) A non-exclusive, worldwide, perpetual, royalty-free, irrevocable
16+
patent license under Licensed Patents to make, have made, use, sell,
17+
offer for sale, and import Covered Works.
18+
19+
This License does not grant any rights in My name, trademarks, service
20+
marks, or logos.
21+
22+
2. Distribution: General Conditions
23+
24+
You may Distribute Covered Works, provided that You (i) inform
25+
recipients how they can obtain a copy of this License; (ii) satisfy the
26+
applicable conditions of sections 3 through 6; and (iii) preserve all
27+
Legal Notices contained in My Work (to the extent they remain
28+
pertinent). "Legal Notices" means copyright notices, license notices,
29+
license texts, and author attributions, but does not include logos,
30+
other graphical images, trademarks or trademark legends.
31+
32+
3. Conditions for Distributing Derived Works; Outbound GPL Compatibility
33+
34+
If You Distribute a Derived Work, You must license the entire Derived
35+
Work as a whole under this License, with prominent notice of such
36+
licensing. This condition may not be avoided through such means as
37+
separate Distribution of portions of the Derived Work.
38+
39+
If the Derived Work includes material licensed under the GPL, You may
40+
instead license the Derived Work under the GPL.
41+
42+
4. Condition Against Further Restrictions; Inbound License Compatibility
43+
44+
When Distributing a Covered Work, You may not impose further
45+
restrictions on the exercise of rights in the Covered Work granted under
46+
this License. This condition is not excused merely because such
47+
restrictions result from Your compliance with conditions or obligations
48+
extrinsic to this License (such as a court order or an agreement with a
49+
third party).
50+
51+
However, You may Distribute a Covered Work incorporating material
52+
governed by a license that is both OSI-Approved and FSF-Free as of the
53+
release date of this License, provided that compliance with such
54+
other license would not conflict with any conditions stated in other
55+
sections of this License.
56+
57+
5. Conditions for Distributing Object Code
58+
59+
You may Distribute an Object Code form of a Covered Work, provided that
60+
you accompany the Object Code with a URL through which the Corresponding
61+
Source is made available, at no charge, by some standard or customary
62+
means of providing network access to source code.
63+
64+
If you Distribute the Object Code in a physical product or tangible
65+
storage medium ("Product"), the Corresponding Source must be available
66+
through such URL for two years from the date of Your most recent
67+
Distribution of the Object Code in the Product. However, if the Product
68+
itself contains or is accompanied by the Corresponding Source (made
69+
available in a customarily accessible manner), You need not also comply
70+
with the first paragraph of this section.
71+
72+
Each direct and indirect recipient of the Covered Work from You is an
73+
intended third-party beneficiary of this License solely as to this
74+
section 5, with the right to enforce its terms.
75+
76+
6. Symmetrical Licensing Condition for Upstream Contributions
77+
78+
If You Distribute a work to Me specifically for inclusion in or
79+
modification of a Covered Work (a "Patch"), and no explicit licensing
80+
terms apply to the Patch, You license the Patch under this License, to
81+
the extent of Your copyright in the Patch. This condition does not
82+
negate the other conditions of this License, if applicable to the Patch.
83+
84+
7. Nullification of Copyleft/Proprietary Dual Licensing
85+
86+
If I offer to license, for a fee, a Covered Work under terms other than
87+
a license that is OSI-Approved or FSF-Free as of the release date of this
88+
License or a numbered version of copyleft-next released by the
89+
Copyleft-Next Project, then the license I grant You under section 1 is no
90+
longer subject to the conditions in sections 3 through 5.
91+
92+
8. Copyleft Sunset
93+
94+
The conditions in sections 3 through 5 no longer apply once fifteen
95+
years have elapsed from the date of My first Distribution of My Work
96+
under this License.
97+
98+
9. Pass-Through
99+
100+
When You Distribute a Covered Work, the recipient automatically receives
101+
a license to My Work from Me, subject to the terms of this License.
102+
103+
10. Termination
104+
105+
Your license grants under section 1 are automatically terminated if You
106+
107+
a) fail to comply with the conditions of this License, unless You cure
108+
such noncompliance within thirty days after becoming aware of it, or
109+
110+
b) initiate a patent infringement litigation claim (excluding
111+
declaratory judgment actions, counterclaims, and cross-claims)
112+
alleging that any part of My Work directly or indirectly infringes
113+
any patent.
114+
115+
Termination of Your license grants extends to all copies of Covered
116+
Works You subsequently obtain. Termination does not terminate the
117+
rights of those who have received copies or rights from You subject to
118+
this License.
119+
120+
To the extent permission to make copies of a Covered Work is necessary
121+
merely for running it, such permission is not terminable.
122+
123+
11. Later License Versions
124+
125+
The Copyleft-Next Project may release new versions of copyleft-next,
126+
designated by a distinguishing version number ("Later Versions").
127+
Unless I explicitly remove the option of Distributing Covered Works
128+
under Later Versions, You may Distribute Covered Works under any Later
129+
Version.
130+
131+
** 12. No Warranty **
132+
** **
133+
** My Work is provided "as-is", without warranty. You bear the risk **
134+
** of using it. To the extent permitted by applicable law, each **
135+
** Distributor of My Work excludes the implied warranties of title, **
136+
** merchantability, fitness for a particular purpose and **
137+
** non-infringement. **
138+
139+
** 13. Limitation of Liability **
140+
** **
141+
** To the extent permitted by applicable law, in no event will any **
142+
** Distributor of My Work be liable to You for any damages **
143+
** whatsoever, whether direct, indirect, special, incidental, or **
144+
** consequential damages, whether arising under contract, tort **
145+
** (including negligence), or otherwise, even where the Distributor **
146+
** knew or should have known about the possibility of such damages. **
147+
148+
14. Severability
149+
150+
The invalidity or unenforceability of any provision of this License
151+
does not affect the validity or enforceability of the remainder of
152+
this License. Such provision is to be reformed to the minimum extent
153+
necessary to make it valid and enforceable.
154+
155+
15. Definitions
156+
157+
"Copyleft-Next Project" means the project that maintains the source
158+
code repository at <https://github.com/copyleft-next/copyleft-next.git/>
159+
as of the release date of this License.
160+
161+
"Corresponding Source" of a Covered Work in Object Code form means (i)
162+
the Source Code form of the Covered Work; (ii) all scripts,
163+
instructions and similar information that are reasonably necessary for
164+
a skilled developer to generate such Object Code from the Source Code
165+
provided under (i); and (iii) a list clearly identifying all Separate
166+
Works (other than those provided in compliance with (ii)) that were
167+
specifically used in building and (if applicable) installing the
168+
Covered Work (for example, a specified proprietary compiler including
169+
its version number). Corresponding Source must be machine-readable.
170+
171+
"Covered Work" means My Work or a Derived Work.
172+
173+
"Derived Work" means a work of authorship that copies from, modifies,
174+
adapts, is based on, is a derivative work of, transforms, translates or
175+
contains all or part of My Work, such that copyright permission is
176+
required. The following are not Derived Works: (i) Mere Aggregation;
177+
(ii) a mere reproduction of My Work; and (iii) if My Work fails to
178+
explicitly state an expectation otherwise, a work that merely makes
179+
reference to My Work.
180+
181+
"Distribute" means to distribute, transfer or make a copy available to
182+
someone else, such that copyright permission is required.
183+
184+
"Distributor" means Me and anyone else who Distributes a Covered Work.
185+
186+
"FSF-Free" means classified as 'free' by the Free Software Foundation.
187+
188+
"GPL" means a version of the GNU General Public License or the GNU
189+
Affero General Public License.
190+
191+
"I"/"Me"/"My" refers to the individual or legal entity that places My
192+
Work under this License. "You"/"Your" refers to the individual or legal
193+
entity exercising rights in My Work under this License. A legal entity
194+
includes each entity that controls, is controlled by, or is under
195+
common control with such legal entity. "Control" means (a) the power to
196+
direct the actions of such legal entity, whether by contract or
197+
otherwise, or (b) ownership of more than fifty percent of the
198+
outstanding shares or beneficial ownership of such legal entity.
199+
200+
"Licensed Patents" means all patent claims licensable royalty-free by
201+
Me, now or in the future, that are necessarily infringed by making,
202+
using, or selling My Work, and excludes claims that would be infringed
203+
only as a consequence of further modification of My Work.
204+
205+
"Mere Aggregation" means an aggregation of a Covered Work with a
206+
Separate Work.
207+
208+
"My Work" means the particular work of authorship I license to You
209+
under this License.
210+
211+
"Object Code" means any form of a work that is not Source Code.
212+
213+
"OSI-Approved" means approved as 'Open Source' by the Open Source
214+
Initiative.
215+
216+
"Separate Work" means a work that is separate from and independent of a
217+
particular Covered Work and is not by its nature an extension or
218+
enhancement of the Covered Work, and/or a runtime library, standard
219+
library or similar component that is used to generate an Object Code
220+
form of a Covered Work.
221+
222+
"Source Code" means the preferred form of a work for making
223+
modifications to it.

README.md

+51-15
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,64 @@ This is a little demo that provides client and server
55
implementations of a counter: concurrent clients grab unique
66
counter values from the server.
77

8-
To build, specify either `--features=tokio-rt` or
9-
`--features=async-std-rt` to get an async client and server
10-
built with the specified async runtime.
8+
You will need a recent nightly Rust toolchain to build and
9+
run this. It is known to work on `x86_64` with the channel
10+
in the `rust-toolchain.toml` file. Just `cargo build
11+
--release`. You will probably want to run the resulting
12+
binary as `target/release/countserver` for ease of arguments
13+
and for timing.
1114

12-
Supplied programs:
15+
Supplied modes:
1316

14-
* `csthread`: Concurrent count server using threads that
15-
access an `Arc`-protected atomic counter.
17+
* Count Servers (`--server`)
1618

17-
* `csthreadscoped`: Concurrent count server using one thread per available CPU,
18-
accessing an atomic counter (without using `Arc`).
19+
* `--seq`: Sequential count server.
1920

20-
* `csasync`: Concurrent count server using async accesses to
21-
an `Arc`-protected atomic counter.
21+
* `--thread`: Concurrent count server using many threads that
22+
access an atomic counter.
2223

23-
* `ccasync`: Concurrent count client that spawns many connections
24-
before collecting all counts.
24+
* `--async`: Concurrent count server using async accesses to
25+
an atomic counter.
2526

26-
Note that on my modern Linux box I need to run these things
27-
as root to get decent performance, and I need to
27+
* Count Clients (`--client`)
28+
29+
* `--seq`: Sequential count client.
30+
31+
* `--thread`: Concurrent count client using many threads that
32+
access an atomic counter.
33+
34+
* `--async`: Concurrent count client using async accesses to
35+
collect counts.
36+
37+
The `-n` flag specifies the total number of transactions
38+
to complete. The default is 100K.
39+
40+
The `-m` thread specifies a target level of parallelism for
41+
some clients and servers. The default is the number of
42+
parallel threads Rust believes is available: typically the
43+
number of threads on the host machine.
44+
45+
Async client and server will use Tokio by default. To use
46+
`async-std`, use the `--alt` argument.
47+
48+
Threaded server will use standard threading by default. To
49+
use a scoped server, use the `--alt` argument.
50+
51+
On my modern Linux box I need to run these things as root to
52+
get decent performance. I also occasionally need to
2853

2954
sysctl net.ipv4.tcp_syncookies=1
3055

3156
to get SYN cookies turned off on localhost. (Sigh. Working
32-
on reporting this.) Don't forget to turn it off when you're done!
57+
on reporting this.) Don't forget to undo this when you're done!
58+
59+
## Acknowledgements
60+
61+
Thanks to Josh Triplett for the scoped-threads server and
62+
for other help with this.
63+
64+
## License
65+
66+
This work is made available under the "Copyleft Next v0.3.1
67+
license." Please see the file `LICENSE.txt` in this
68+
distribution for license terms.

0 commit comments

Comments
 (0)