Commit Graph

69 Commits

Author SHA1 Message Date
9e32d014c2 Restructuring parser
Adding tests fore everything
2026-01-03 02:34:04 +00:00
f99b44fdb2 Fix double free
was freeing the wrong element before.
2026-01-03 02:33:12 +00:00
5a7d3caf9c Subject validation 2026-01-02 23:57:40 +00:00
a21dbfe3bb Remove unnecessary explicit enum
This can be computed (as it is now)
2026-01-02 23:31:16 +00:00
0f851a140d Fix possible race condition
since the queue was being set in an async task and we were then calling send asserting that the queue was set, we could have triggered a panic.
didn't run into it but seemed likely to cause issues in the future.

also compute the buffer size for operators at comptime.
2026-01-02 23:13:54 +00:00
67908cf198 Move handshake from client to server 2026-01-02 22:37:54 +00:00
29e5b92ee0 Only check for ctrl+c every 10 ms 2026-01-02 20:50:57 +00:00
90b5b1548f Add branch hints for high performance messaging. 2026-01-02 20:35:58 +00:00
9e9f7e8e50 Fix connect parsing 2026-01-02 20:28:26 +00:00
5f24108014 Don't assume capacity 2026-01-02 19:53:53 +00:00
6374952941 remove debug log 2026-01-02 19:34:59 +00:00
c38d13e911 Rework pub and hpub parse
support hpub in general, and properly support reply subjects
2026-01-02 19:16:07 +00:00
cd5281030e 2026-01-02 18:10:25 +00:00
2be370e379 Support subject patterns
clean up some tests
2026-01-02 15:29:58 +00:00
539255adb1 broke 100 mbps!!
coder@08714a4174bb:~$ nats bench sub foo -s localhost:4223
14:33:02 Starting Core NATS subscriber benchmark [clients=1, msg-size=128 B, msgs=100,000, multi-subject=false, subject=foo]
14:33:02 [1] Starting Core NATS subscriber, expecting 100,000 messages
Finished      0s [===============================================================================================================================] 100%

NATS Core NATS subscriber stats: 934,205 msgs/sec ~ 114 MiB/sec ~ 1.07us
2026-01-02 14:34:32 +00:00
faa552969d Nicer logging 2026-01-02 14:31:34 +00:00
810e5f8211 Much better cleanup, still fast B) 2026-01-02 14:11:23 +00:00
aca265f095 Cleanup on error 2026-01-02 13:58:23 +00:00
4bf064056c reorganize but crashing
not sure why, seems like i'm using the right allocators everywhere?
need to take another pass at this later.
2026-01-02 04:01:03 +00:00
a71f08e1f6 formatting 2026-01-02 02:18:37 +00:00
9ee8317cb0 Remove dead comments 2026-01-01 22:14:36 +00:00
5a395bdadf Use group to make it easier to clean up client tasks on exit 2026-01-01 22:14:36 +00:00
a3e026ebf1 Cleanup for deinitializing 2026-01-01 22:14:36 +00:00
fc68749669 gracefully exit
simplify code
clean up dead code
2026-01-01 20:26:41 +00:00
987dc492a6 97 mbps !!! super fast
dosen't flush every message, pulls batches from the queue to send, and flushes at the end of each batch.
batches are a min of 1 message, but may be more.
2026-01-01 19:16:58 +00:00
86558986ef Slower, but probably more correct 2026-01-01 18:50:52 +00:00
ca95c9a06c Lock subs when reading it
should probably make a copy instead of doing io in the mutex
2026-01-01 18:50:03 +00:00
ec1912ba7e Use a small stack buffer for client io 2026-01-01 16:55:04 +00:00
7baa2ed2ec Use master yazap
Works against the latest master branch for zig again :)
2026-01-01 16:29:29 +00:00
45bd63dbe1 Actually fast again???
way faster than before even??

coder@08714a4174bb:~$ nats bench pub foo -s localhost:4223
05:12:23 Starting Core NATS publisher benchmark [clients=1, msg-size=128 B, msgs=100,000, multi-subject=false, multi-subject-max=100,000, sleep=0s, subject=foo]
05:12:23 [1] Starting Core NATS publisher, publishing 100,000 messages
Finished      0s [====================================================================================] 100%

NATS Core NATS publisher stats: 574,666 msgs/sec ~ 70 MiB/sec ~ 1.74us

So cool.

src/server/client.zig JJ: M src/server/main.zig JJ: JJ: Lines starting with "JJ:" (like this one) will be 
removed.
2026-01-01 05:22:03 +00:00
5dea33367e reorganize some things 2026-01-01 05:22:03 +00:00
f289ab7893 Rename ClientState to Client 2026-01-01 05:22:03 +00:00
4fcb9e3943 Heap allocate client buffers 2026-01-01 05:22:02 +00:00
0233bc278c Avoid queues completely
This is quite slow
2026-01-01 05:22:02 +00:00
b447883d10 Reorganized things 2026-01-01 05:22:02 +00:00
7af7a30ed2 things are running quite smoothly!!!
coder@08714a4174bb:~$ nats bench sub foo -s localhost:4223
03:28:04 Starting Core NATS subscriber benchmark [clients=1, msg-size=128 B, msgs=100,000, multi-subject=false, subject=foo]
03:28:04 [1] Starting Core NATS subscriber, expecting 100,000 messages
Finished      6s [====================================================================================] 100%

NATS Core NATS subscriber stats: 14,691 msgs/sec ~ 1.8 MiB/sec ~ 68.06us
2026-01-01 05:22:02 +00:00
a781876038 Simplified a ton of things and cleaned up ownership 2026-01-01 05:22:02 +00:00
0f138e5984 some cleanup and freeing 2026-01-01 05:22:02 +00:00
e60a566a7c Cleanup client
Break up creating and starting the client process.
I think this should simplify storing the std.Io.Queue on the stack.
Before I was storing it on the heap because it was hard to make it point to the same location if I was initializing the client on the stack.
2026-01-01 05:22:02 +00:00
1cbd030037 Rename assert to expect
Assert implies panic, expect implies error
2026-01-01 05:22:02 +00:00
1b6447a986 Fix sub parse bug
Was accidentally consuming one more byte than I was expecting when reaching the end of the second term.
This was causing the parser to work properly in the case that a queue group was specified, but failing and consuming the next message (usually a PING) as the SID.
2025-12-31 00:56:34 +00:00
d4566eba52 Reuse port
This lets me dev cycle faster
Shouldn't have to do this though, should be cleaning up properly
2025-12-31 00:55:38 +00:00
fe4c1d410b More cleanup 2025-12-29 04:56:54 +00:00
b9d0672971 Parsing cleanup 2025-12-29 04:49:25 +00:00
4bf5ddca15 publish works
starting to use errors instead of unreachable for stream parsing
2025-12-29 04:23:16 +00:00
335c4aa092 2025-12-29 00:35:06 +00:00
18f4475aaf 2025-12-28 22:22:33 +00:00
50870da1d9 made some progress on subscriptions 2025-12-10 00:11:12 -05:00
5fd580045d Add branch hint for message publish 2025-12-09 21:16:44 -05:00
45e8c4cc08 sending errors on pub sub! 2025-12-09 18:22:41 -05:00