opal-up 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +209 -0
- data/README.md +97 -29
- data/bin/up_ruby +4 -0
- data/bin/up_ruby_cluster +4 -0
- data/ext/up_ext/App.h +606 -0
- data/ext/up_ext/AsyncSocket.h +355 -0
- data/ext/up_ext/AsyncSocketData.h +87 -0
- data/ext/up_ext/BloomFilter.h +83 -0
- data/ext/up_ext/ChunkedEncoding.h +236 -0
- data/ext/up_ext/ClientApp.h +36 -0
- data/ext/up_ext/HttpContext.h +502 -0
- data/ext/up_ext/HttpContextData.h +56 -0
- data/ext/up_ext/HttpErrors.h +53 -0
- data/ext/up_ext/HttpParser.h +680 -0
- data/ext/up_ext/HttpResponse.h +578 -0
- data/ext/up_ext/HttpResponseData.h +95 -0
- data/ext/up_ext/HttpRouter.h +380 -0
- data/ext/up_ext/Loop.h +204 -0
- data/ext/up_ext/LoopData.h +112 -0
- data/ext/up_ext/MoveOnlyFunction.h +377 -0
- data/ext/up_ext/PerMessageDeflate.h +315 -0
- data/ext/up_ext/ProxyParser.h +163 -0
- data/ext/up_ext/QueryParser.h +120 -0
- data/ext/up_ext/TopicTree.h +363 -0
- data/ext/up_ext/Utilities.h +66 -0
- data/ext/up_ext/WebSocket.h +381 -0
- data/ext/up_ext/WebSocketContext.h +434 -0
- data/ext/up_ext/WebSocketContextData.h +109 -0
- data/ext/up_ext/WebSocketData.h +86 -0
- data/ext/up_ext/WebSocketExtensions.h +256 -0
- data/ext/up_ext/WebSocketHandshake.h +145 -0
- data/ext/up_ext/WebSocketProtocol.h +506 -0
- data/ext/up_ext/bsd.c +767 -0
- data/ext/up_ext/bsd.h +109 -0
- data/ext/up_ext/context.c +524 -0
- data/ext/up_ext/epoll_kqueue.c +458 -0
- data/ext/up_ext/epoll_kqueue.h +67 -0
- data/ext/up_ext/extconf.rb +5 -0
- data/ext/up_ext/internal.h +224 -0
- data/ext/up_ext/libusockets.h +350 -0
- data/ext/up_ext/libuwebsockets.cpp +1344 -0
- data/ext/up_ext/libuwebsockets.h +396 -0
- data/ext/up_ext/loop.c +386 -0
- data/ext/up_ext/loop_data.h +38 -0
- data/ext/up_ext/socket.c +231 -0
- data/ext/up_ext/up_ext.c +930 -0
- data/lib/up/bun/rack_env.rb +1 -13
- data/lib/up/bun/server.rb +93 -19
- data/lib/up/cli.rb +3 -0
- data/lib/up/client.rb +68 -0
- data/lib/up/ruby/cluster.rb +39 -0
- data/lib/up/ruby/cluster_cli.rb +10 -0
- data/lib/up/{node → ruby}/rack_cluster.rb +5 -4
- data/lib/up/{node → ruby}/rack_server.rb +4 -4
- data/lib/up/ruby/server_cli.rb +10 -0
- data/lib/up/u_web_socket/cluster.rb +18 -3
- data/lib/up/u_web_socket/server.rb +108 -15
- data/lib/up/version.rb +1 -1
- metadata +72 -30
- data/.gitignore +0 -5
- data/Gemfile +0 -2
- data/bin/up_node +0 -12
- data/bin/up_node_cluster +0 -12
- data/example_rack_app/Gemfile +0 -3
- data/example_rack_app/config.ru +0 -6
- data/example_rack_app/rack_app.rb +0 -5
- data/example_roda_app/Gemfile +0 -6
- data/example_roda_app/config.ru +0 -6
- data/example_roda_app/roda_app.rb +0 -37
- data/example_sinatra_app/Gemfile +0 -6
- data/example_sinatra_app/config.ru +0 -6
- data/example_sinatra_app/sinatra_app.rb +0 -7
- data/lib/up/node/cluster.rb +0 -39
- data/lib/up/node/cluster_cli.rb +0 -15
- data/lib/up/node/rack_env.rb +0 -106
- data/lib/up/node/server.rb +0 -84
- data/lib/up/node/server_cli.rb +0 -15
- data/lib/up/u_web_socket/rack_env.rb +0 -101
- data/opal-up.gemspec +0 -27
- data/up_logo.svg +0 -256
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b5f1d401dd86a88d34ec1137b212d166a60dc376acb94f2123d6c4b29f0dd61
|
4
|
+
data.tar.gz: f8f37f91e0de3dbd37974411e08babe4c5c07a3f1776f9d63016d7b6da13becc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e4b3f682584aca6cac12aa0cdc97304005d6d791bbd2a7228f353298290dbd05feabe9409eb1863cbce5120c416ef94c111c1498bdbb9984bc7ab2eb2b10b82
|
7
|
+
data.tar.gz: 5834fece6b8c7ee428242bdfaebb65e49c7cdbc4f2df8b125c05485b476ec471ba5e3c7287c4d00d72cb20851bbd6f2dcf13c748d1f483b1ee42a03617239e75
|
data/LICENSE
CHANGED
@@ -19,3 +19,212 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
21
|
SOFTWARE.
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Files from the uWebSocket project in the lib/up_ext directory have been
|
26
|
+
originally taken from https://github.com/uNetworking/uWebSockets and
|
27
|
+
employ the Apache License as follows and as specified within the files itself:
|
28
|
+
|
29
|
+
Apache License
|
30
|
+
Version 2.0, January 2004
|
31
|
+
http://www.apache.org/licenses/
|
32
|
+
|
33
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
34
|
+
|
35
|
+
1. Definitions.
|
36
|
+
|
37
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
38
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
39
|
+
|
40
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
41
|
+
the copyright owner that is granting the License.
|
42
|
+
|
43
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
44
|
+
other entities that control, are controlled by, or are under common
|
45
|
+
control with that entity. For the purposes of this definition,
|
46
|
+
"control" means (i) the power, direct or indirect, to cause the
|
47
|
+
direction or management of such entity, whether by contract or
|
48
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
49
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
50
|
+
|
51
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
52
|
+
exercising permissions granted by this License.
|
53
|
+
|
54
|
+
"Source" form shall mean the preferred form for making modifications,
|
55
|
+
including but not limited to software source code, documentation
|
56
|
+
source, and configuration files.
|
57
|
+
|
58
|
+
"Object" form shall mean any form resulting from mechanical
|
59
|
+
transformation or translation of a Source form, including but
|
60
|
+
not limited to compiled object code, generated documentation,
|
61
|
+
and conversions to other media types.
|
62
|
+
|
63
|
+
"Work" shall mean the work of authorship, whether in Source or
|
64
|
+
Object form, made available under the License, as indicated by a
|
65
|
+
copyright notice that is included in or attached to the work
|
66
|
+
(an example is provided in the Appendix below).
|
67
|
+
|
68
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
69
|
+
form, that is based on (or derived from) the Work and for which the
|
70
|
+
editorial revisions, annotations, elaborations, or other modifications
|
71
|
+
represent, as a whole, an original work of authorship. For the purposes
|
72
|
+
of this License, Derivative Works shall not include works that remain
|
73
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
74
|
+
the Work and Derivative Works thereof.
|
75
|
+
|
76
|
+
"Contribution" shall mean any work of authorship, including
|
77
|
+
the original version of the Work and any modifications or additions
|
78
|
+
to that Work or Derivative Works thereof, that is intentionally
|
79
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
80
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
81
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
82
|
+
means any form of electronic, verbal, or written communication sent
|
83
|
+
to the Licensor or its representatives, including but not limited to
|
84
|
+
communication on electronic mailing lists, source code control systems,
|
85
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
86
|
+
Licensor for the purpose of discussing and improving the Work, but
|
87
|
+
excluding communication that is conspicuously marked or otherwise
|
88
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
89
|
+
|
90
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
91
|
+
on behalf of whom a Contribution has been received by Licensor and
|
92
|
+
subsequently incorporated within the Work.
|
93
|
+
|
94
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
95
|
+
this License, each Contributor hereby grants to You a perpetual,
|
96
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
97
|
+
copyright license to reproduce, prepare Derivative Works of,
|
98
|
+
publicly display, publicly perform, sublicense, and distribute the
|
99
|
+
Work and such Derivative Works in Source or Object form.
|
100
|
+
|
101
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
102
|
+
this License, each Contributor hereby grants to You a perpetual,
|
103
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
104
|
+
(except as stated in this section) patent license to make, have made,
|
105
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
106
|
+
where such license applies only to those patent claims licensable
|
107
|
+
by such Contributor that are necessarily infringed by their
|
108
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
109
|
+
with the Work to which such Contribution(s) was submitted. If You
|
110
|
+
institute patent litigation against any entity (including a
|
111
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
112
|
+
or a Contribution incorporated within the Work constitutes direct
|
113
|
+
or contributory patent infringement, then any patent licenses
|
114
|
+
granted to You under this License for that Work shall terminate
|
115
|
+
as of the date such litigation is filed.
|
116
|
+
|
117
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
118
|
+
Work or Derivative Works thereof in any medium, with or without
|
119
|
+
modifications, and in Source or Object form, provided that You
|
120
|
+
meet the following conditions:
|
121
|
+
|
122
|
+
(a) You must give any other recipients of the Work or
|
123
|
+
Derivative Works a copy of this License; and
|
124
|
+
|
125
|
+
(b) You must cause any modified files to carry prominent notices
|
126
|
+
stating that You changed the files; and
|
127
|
+
|
128
|
+
(c) You must retain, in the Source form of any Derivative Works
|
129
|
+
that You distribute, all copyright, patent, trademark, and
|
130
|
+
attribution notices from the Source form of the Work,
|
131
|
+
excluding those notices that do not pertain to any part of
|
132
|
+
the Derivative Works; and
|
133
|
+
|
134
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
135
|
+
distribution, then any Derivative Works that You distribute must
|
136
|
+
include a readable copy of the attribution notices contained
|
137
|
+
within such NOTICE file, excluding those notices that do not
|
138
|
+
pertain to any part of the Derivative Works, in at least one
|
139
|
+
of the following places: within a NOTICE text file distributed
|
140
|
+
as part of the Derivative Works; within the Source form or
|
141
|
+
documentation, if provided along with the Derivative Works; or,
|
142
|
+
within a display generated by the Derivative Works, if and
|
143
|
+
wherever such third-party notices normally appear. The contents
|
144
|
+
of the NOTICE file are for informational purposes only and
|
145
|
+
do not modify the License. You may add Your own attribution
|
146
|
+
notices within Derivative Works that You distribute, alongside
|
147
|
+
or as an addendum to the NOTICE text from the Work, provided
|
148
|
+
that such additional attribution notices cannot be construed
|
149
|
+
as modifying the License.
|
150
|
+
|
151
|
+
You may add Your own copyright statement to Your modifications and
|
152
|
+
may provide additional or different license terms and conditions
|
153
|
+
for use, reproduction, or distribution of Your modifications, or
|
154
|
+
for any such Derivative Works as a whole, provided Your use,
|
155
|
+
reproduction, and distribution of the Work otherwise complies with
|
156
|
+
the conditions stated in this License.
|
157
|
+
|
158
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
159
|
+
any Contribution intentionally submitted for inclusion in the Work
|
160
|
+
by You to the Licensor shall be under the terms and conditions of
|
161
|
+
this License, without any additional terms or conditions.
|
162
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
163
|
+
the terms of any separate license agreement you may have executed
|
164
|
+
with Licensor regarding such Contributions.
|
165
|
+
|
166
|
+
6. Trademarks. This License does not grant permission to use the trade
|
167
|
+
names, trademarks, service marks, or product names of the Licensor,
|
168
|
+
except as required for reasonable and customary use in describing the
|
169
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
170
|
+
|
171
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
172
|
+
agreed to in writing, Licensor provides the Work (and each
|
173
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
174
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
175
|
+
implied, including, without limitation, any warranties or conditions
|
176
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
177
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
178
|
+
appropriateness of using or redistributing the Work and assume any
|
179
|
+
risks associated with Your exercise of permissions under this License.
|
180
|
+
|
181
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
182
|
+
whether in tort (including negligence), contract, or otherwise,
|
183
|
+
unless required by applicable law (such as deliberate and grossly
|
184
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
185
|
+
liable to You for damages, including any direct, indirect, special,
|
186
|
+
incidental, or consequential damages of any character arising as a
|
187
|
+
result of this License or out of the use or inability to use the
|
188
|
+
Work (including but not limited to damages for loss of goodwill,
|
189
|
+
work stoppage, computer failure or malfunction, or any and all
|
190
|
+
other commercial damages or losses), even if such Contributor
|
191
|
+
has been advised of the possibility of such damages.
|
192
|
+
|
193
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
194
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
195
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
196
|
+
or other liability obligations and/or rights consistent with this
|
197
|
+
License. However, in accepting such obligations, You may act only
|
198
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
199
|
+
of any other Contributor, and only if You agree to indemnify,
|
200
|
+
defend, and hold each Contributor harmless for any liability
|
201
|
+
incurred by, or claims asserted against, such Contributor by reason
|
202
|
+
of your accepting any such warranty or additional liability.
|
203
|
+
|
204
|
+
END OF TERMS AND CONDITIONS
|
205
|
+
|
206
|
+
APPENDIX: How to apply the Apache License to your work.
|
207
|
+
|
208
|
+
To apply the Apache License to your work, attach the following
|
209
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
210
|
+
replaced with your own identifying information. (Don't include
|
211
|
+
the brackets!) The text should be enclosed in the appropriate
|
212
|
+
comment syntax for the file format. We also recommend that a
|
213
|
+
file or class name and description of purpose be included on the
|
214
|
+
same "printed page" as the copyright notice for easier
|
215
|
+
identification within third-party archives.
|
216
|
+
|
217
|
+
Copyright [yyyy] [name of copyright owner]
|
218
|
+
|
219
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
220
|
+
you may not use this file except in compliance with the License.
|
221
|
+
You may obtain a copy of the License at
|
222
|
+
|
223
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
224
|
+
|
225
|
+
Unless required by applicable law or agreed to in writing, software
|
226
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
227
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
228
|
+
See the License for the specific language governing permissions and
|
229
|
+
limitations under the License.
|
230
|
+
|
data/README.md
CHANGED
@@ -1,40 +1,60 @@
|
|
1
1
|
<img src="https://raw.githubusercontent.com/janbiedermann/up/master/up_logo.svg" alt="UP Logo">
|
2
|
-
<small>Original Image by <a href="https://www.freepik.com/free-vector/colorful-arrows_715199.htm#query=up&position=3&from_view=search&track=sph&uuid=63f9eddf-02a6-4e5c-8178-8cfa507ee33d">Freepik</a>, modified though</small>
|
2
|
+
<small>(Original Image by <a href="https://www.freepik.com/free-vector/colorful-arrows_715199.htm#query=up&position=3&from_view=search&track=sph&uuid=63f9eddf-02a6-4e5c-8178-8cfa507ee33d">Freepik</a>, modified though)</small>
|
3
3
|
|
4
4
|
# UP!
|
5
5
|
|
6
|
-
A high performance Rack server for Opal Ruby, Tech Demo
|
6
|
+
A high performance Rack server for [Opal Ruby](https://opalrb.com/) and [Matz Ruby](https://www.ruby-lang.org/), Tech Demo
|
7
7
|
|
8
8
|
## Let Numbers speak first
|
9
9
|
|
10
10
|
```
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
Up!
|
21
|
-
Up! uWS:
|
22
|
-
|
23
|
-
|
11
|
+
Response type: env.to_s "hello_world"
|
12
|
+
Requests/Second Latency Requests/Second Latency
|
13
|
+
Puma: 8884.53 req/s 15.18 ms 50822.38 req/s 2.62 ms
|
14
|
+
Unicorn: 12302.35 req/s 10.22 ms 16329.68 req/s 7.68 ms
|
15
|
+
Falcon: 13168.82 req/s 9.49 ms 24041.63 req/s 5.26 ms
|
16
|
+
Racer: 14536.88 req/s 8.94 ms 15354.14 req/s 8.44 ms
|
17
|
+
Agoo: 49078.57 req/s 2.54 ms 89022.91 req/s 1.51 ms
|
18
|
+
Iodine: 59116.53 req/s 2.11 ms <<< 134267.79 req/s 0.93 ms
|
19
|
+
Up! bun: 3900.44 req/s 32.00 ms 47334.16 req/s 2.64 ms
|
20
|
+
Up! ruby: 22144.33 req/s 5.64 ms 58704.09 req/s 2.14 ms
|
21
|
+
Up! uWS: 6540.62 req/s 19.09 ms 78384.93 req/s 1.59 ms
|
22
|
+
Up! ruby cluster: 53641.29 req/s 2.35 ms 128237.52 req/s 0.97 ms
|
23
|
+
Up! uWS cluster: 20143.62 req/s 6.20 ms 152353.97 req/s 0.82 ms <<<
|
24
|
+
|
25
|
+
<<< denotes the fastest for the response type
|
26
|
+
|
27
|
+
running on/with:
|
28
|
+
Linux, Kernel 6.5.0-x
|
24
29
|
ruby 3.3.0, YJit enabled
|
25
|
-
Opal
|
30
|
+
Opal 2.0-dev as of 9. Feb 2024, with node v20.11.0
|
26
31
|
Puma 6.4.2, 4 workers, 4 threads
|
27
|
-
|
28
|
-
|
29
|
-
|
32
|
+
Falcon 0.43.0, 4 workers, 4 threads
|
33
|
+
Racer 0.1.3, defaults
|
34
|
+
Unicorn 6.1.0, 4 workers
|
35
|
+
Agoo 2.15.8, 4 workers, 4 threads
|
36
|
+
Iodine 0.7.57, 4 workers, 1 thread
|
37
|
+
Up! uWS 0.0.4, 1 worker
|
38
|
+
Up! Node 0.0.4, 1 worker
|
39
|
+
Up! Ruby 0.0.4, 1 worker
|
40
|
+
Up! uWS cluster 0.0.4, 4 workers
|
41
|
+
Up! Node cluster 0.0.4, 4 workers
|
42
|
+
Up! Ruby cluster 0.0.4, 4 workers
|
30
43
|
|
31
44
|
running the example_rack_app from this repo, benchmarked with:
|
32
|
-
|
45
|
+
bombardier http://localhost:3000/
|
46
|
+
and taking the Avg
|
47
|
+
|
48
|
+
on a Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
|
33
49
|
```
|
34
50
|
|
35
51
|
## Introduction
|
36
52
|
|
37
|
-
This is currently mainly a technical demonstration, demonstrating the speed of the Opal Ruby implementation employing Node and
|
53
|
+
This is currently mainly a technical demonstration, demonstrating the speed of the [Opal Ruby](https://github.com/opal/opal) implementation employing [Node](https://nodejs.org/en) and [uWebSocketJs](https://github.com/uNetworking/uWebSockets.js) as runtime.
|
54
|
+
|
55
|
+
Its not yet a generic, all purpose Rack server, but good for further experimentation, research and open for improvement. The included ruby version allows for verification of code correctness and performance. If it works with `bundle exec up_ruby` it should work equally well with the various Opal versions, at least thats the future goal.
|
56
|
+
|
57
|
+
Its a intention of this project, to serve as a tool for enhancing Opal Ruby and porting Rack apps from Matz to Opal Ruby.
|
38
58
|
|
39
59
|
## Getting started
|
40
60
|
|
@@ -52,13 +72,13 @@ For a Gemfile available from rubygems:
|
|
52
72
|
|
53
73
|
## Available Commands
|
54
74
|
|
55
|
-
Available with `bundle exec` within the example apps or if this gem
|
75
|
+
Available with `bundle exec` within the example apps or if this gem is included in your Gemfile:
|
56
76
|
|
57
|
-
- `up` - starts a single worker server using
|
58
|
-
- `up_cluster` - starts a cluster of workers using
|
59
|
-
- `up_node` - starts a single worker server using the standard Node HTTP(S) classes
|
60
|
-
- `up_node_cluster` - starts a cluster of workers using the standard Node HTTP(S) classes, probably faster than `up_node`
|
77
|
+
- `up` - starts a single worker server using Opal with uWebSockets
|
78
|
+
- `up_cluster` - starts a cluster of workers using Opal with uWebSockets, fastest server
|
61
79
|
- `up_bun` - starts single worker server using Bun, requires Opal bun support from [PR#2622](https://github.com/opal/opal/pull/2622)
|
80
|
+
- `up_ruby` - starts a single worker using Ruby with uWebSockets in a native extension, does not support the --secure option/TLS
|
81
|
+
- `up_ruby_cluster` - starts a cluster of workers using Ruby with uWebSockets in a native extension, does not support the --secure options/TLS
|
62
82
|
|
63
83
|
```
|
64
84
|
Usage: up [options]
|
@@ -74,10 +94,58 @@ When using secure sockets, the -a, -c and -k options must be provided
|
|
74
94
|
-v, --version Show version
|
75
95
|
|
76
96
|
```
|
97
|
+
## Supported Features
|
98
|
+
|
99
|
+
Up! implements the [Rack Spec as of Rack 3.0](https://github.com/rack/rack/blob/main/SPEC.rdoc) with the following differences:
|
100
|
+
- `rack.hijack` is not implemented, but `rack.upgrade` instead is, see "Websockets" below
|
101
|
+
- `rack.input` is currently still missing
|
102
|
+
- Tempfile support is currently incomplete, affecting a few keys in the Rack Env ('tempfile' missing in Opal).
|
103
|
+
- Some Rack modules/classes still have issues when run in Opal and may not work as expected
|
104
|
+
|
105
|
+
Websockets are supported following the [Iodine SPEC-WebSocket-Draft](https://github.com/boazsegev/iodine/blob/master/SPEC-WebSocket-Draft.md).
|
106
|
+
PubSub is supported following the [Iodine SPEC-PubSub-Draft](https://github.com/boazsegev/iodine/blob/master/SPEC-PubSub-Draft.md), except for engines.
|
107
|
+
|
108
|
+
A example RackApp using WebSockets and PubSub is provided in the 'example_rack_ws_app' directory
|
109
|
+
|
110
|
+
## Roda
|
111
|
+
|
112
|
+
A example app for Roda is provided and _appears_ working with the following patches applied:
|
113
|
+
|
114
|
+
- [Changes required to make Roda _appear_ to work](https://github.com/jeremyevans/roda/compare/master...janbiedermann:roda:master)
|
115
|
+
- [Changes required to make Rack with Roda _appear_ to work](https://github.com/janbiedermann/rack/commit/1dadea0f9813c2df94715052d2277af13f7d0c0c)
|
116
|
+
|
117
|
+
Please note the phrase "_appear_ to work" in above sentences.
|
118
|
+
To try:
|
119
|
+
- clone Rack 3.0.9 and Roda 3.76
|
120
|
+
- apply the patch sets above
|
121
|
+
- set paths in the example_roda_app to point to your cloned rack & roda repos
|
122
|
+
- and up! the server
|
123
|
+
|
124
|
+
## Sinatra, others ...
|
125
|
+
|
126
|
+
... currently do not work! A example app for Sinatra is provided, for convenience of developing and expanding the capabilities of Opal.
|
127
|
+
|
128
|
+
- [Sinatra patches](https://github.com/sinatra/sinatra/compare/main...janbiedermann:sinatra:main)
|
129
|
+
- [Mustermann patches](https://github.com/sinatra/mustermann/compare/main...janbiedermann:mustermann:main)
|
130
|
+
- [Rack-Session patches](https://github.com/rack/rack-session/compare/main...janbiedermann:rack-session:main)
|
131
|
+
|
132
|
+
## About the Benchmarks
|
133
|
+
|
134
|
+
The benchmarks mainly test the overhead introduced by the rack server.
|
135
|
+
|
136
|
+
In the 'env.to_s' benchmark, the Rack environment access and response header handling overhead are measured. Simply calling env.to_s accesses all keys and serializes them briefly. If the Rack app accesses the keys of the Rack environment and sets response headers, the overhead/latency as measured can be expected, or that amount of requests per second can be expected at most.
|
137
|
+
|
138
|
+
The "hello_world" benchmark measures the overhead for the simplest possible version of a meaningful Rack response and should provide maximum performance. If the Rack app just replies with a string, that overhead/latency can be expected, or that amount of requests per second can be expected at most.
|
77
139
|
|
78
|
-
##
|
140
|
+
## Links
|
79
141
|
|
80
|
-
|
142
|
+
- bombardier, the tool used for benchmarking: [https://github.com/codesenberg/bombardier](https://github.com/codesenberg/bombardier)
|
81
143
|
|
82
|
-
|
144
|
+
### Rack Servers
|
83
145
|
|
146
|
+
- [Agoo](https://github.com/ohler55/agoo)
|
147
|
+
- [Falcon](https://github.com/socketry/falcon)
|
148
|
+
- [Iodine](https://github.com/boazsegev/iodine)
|
149
|
+
- [Puma](https://github.com/puma/puma)
|
150
|
+
- [Racer](https://rubygems.org/gems/racer) (a bit old, but included here, because it uses libuv, just like Node)
|
151
|
+
- [Unicorn](https://yhbt.net/unicorn/)
|
data/bin/up_ruby
ADDED
data/bin/up_ruby_cluster
ADDED