FastNet - Very-Fast (Highly Performance), low-latency & low bandwidth usages

FastNet

Hello, everyone!
so, today i want to share my first time made networking system

This FastNet module is basic and simple networking based with rateLimiter and queue system. but it’s really powerful (Very Fast, low latency, and low bandwidth usages)
also you can change the default FastNet settings in FastNet Module

APIs
Server & Client

Server-Side


Client-Side

Download Source

GitHub: here
Roblox Library: here
Download File (.rbxm):
FastNet.rbxm (9.8 KB)

Example

-------- SERVER SCRIPT SIDE --------

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Network = require(ReplicatedStorage:WaitForChild("Network")).Init()

-- Create New Remote (typeRemote, NameRemote)
Network:CreateRemote("RemoteEvent", "Remote1")
Network:CreateRemote("RemoteFunction", "Remote2")

-- RemoteEvent.OnServerEvent
Network:ListenServerEvent("Remote1"):Connect(function(player, data_receive)
	print(player, data_receive)
end)
-- RemoteFunction.OnServerInvoke
Network:ListenServerInvoke("Remote2").OnServerInvoke = function(player, data_receive)
	print(player, data_receive)
end

------ CLIENT LOCAL SCRIPT SIDE ------

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Network = require(ReplicatedStorage:WaitForChild("Network"))

-- Name Remote, data to sent
Network:FireServer("Remote1", {"Hello!"})
Network:InvokeServer("Remote2", {"Welcome!"})

RateLimit Test

------ CLIENT LOCAL SCRIPT SIDE ------

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Network = require(ReplicatedStorage:WaitForChild("Network")):Controller()

while task.wait() do
	task.spawn(function()
		Network:FireServer("Remote1", {"Hello!"})
		Network:InvokeServer("Remote2", {"Welcome!"})
	end)
end

Comparison Speedtests (Stress-Benchmark)

Benchmark 1 (FastNet v1.0-Beta)


Benchmark 2 (FastNet v1.0-Beta)

Benchmark 3 (FastNet v1.1-Beta)

Benchmark 4 (FastNet v2.0-release, 75 fires per frame)
image
Benchmark 5 (FastNet v1.3-beta, FastNet RateLimiter Settings disabled/off)
image
Benchmark 6 (FastNet v2.0-release, 30 fires per frame)
image
Benchmark 7 (FastNet v2.0-release, 125 fires per frame)
score


Benchmark 8 (FastNet v2.0-release, 75 fires per frame)

Benchmark 9 (FastNet v2.0-release, BridgeNet v2.0.0-rc4)




Benchmark 10 (FastNet v2.1-release, BridgeNet v2.0.0-rc4)

That pictures showing compare stress benchmark result using RunService.Heartbeat no delations for 30s (BridgeNet seems unstable), and FastNet Module is really keep stable to handle many Remote calls connection.

Note

BridgeNet Module 2.0.0-r3 version (except benchmark 9 & 10)

Latest version: 2.3 - Release


Give your feedback!

Are you going to use FastNet Module?

  • Yes
  • No
  • Maybe later

0 voters

What did you think on FastNet Peformance and the Features?

  • Great
  • Not to bad. (or Good enough)
  • Is Bad.

0 voters

So far, which is best/good network module for you?

  • FastNet
  • BridgeNet
  • Yucon Framework
  • EasyNetwork
  • Something else
  • I don’t use any

0 voters

What did you think on our compare speedtest - stress benchmarking?

  • Cool, I suprised
  • Cool.
  • nothing.

0 voters

Is hard using FastNet?

  • Yes
  • Not to hard (decent/normal)
  • Is not (easy)

0 voters

2 Likes

Hmm, what does this offer compare to BridgeNet? It seems like all these networking modules started popping after BridgeNet was released so I want to know what this module offer compare to BridgeNet.

5 Likes

MINOR UPDATE - v1.1 - Beta

Added :Remove Function (Server)

local Remote = Network:CreateRemote("RemoteEvent", "Remote1")
Remote:Remove()

OR

Network:Remove("Remote1")

:Remove() function used for remove/destroy the remote

Added new thing when created remote

local NetRemote = Network:CreateRemote("RemoteEvent", "Remote1")
local NetRemote2 = Network:CreateRemote("RemoteFunction", "Remote2")
NetRemote.Remote:Connect(function(player, data_receive)
end)
NetRemote2.Remote.OnServerInvoke = function(player, data_receive)
end

Previous method still can be used

Network:ListenServerEvent("Remote1"):Connect(function(player, data_receive)
end)
Network:ListenServerInvoke("Remote2") = function(player, data_receive)
end)

:CreateRemote() now return table

Added :GetVersion() - Server & Client

print(Network:GetVersion())

Added Back :ListenClientInvoke() & :ListenClientEvent() Function (Client)

Network:ListenClientEvent("Remote1"):Connect(function(data_receive)
end)
Network:ListenClientInvoke("Remote2").OnClientInvoke = function(data_receive)
end

Removed :Controller() Function (Client)
so you can instantly use the module on client

local Network = require(ReplicatedStorage.Network)
Network:FireServer("Remote1", "Yo! Update 1.1??")
Network:ListenClientEvent("_Update"):Connect(function(...)
end)

Changes on Default Settings
Bugs Fixed, Improvement Syntax & Functional

2 Likes

MINOR UPDATE - v1.2 - Beta

Added :GetLogTraffic() Function (Server & Client)

local Network = require(ReplicatedStorage.Network)
Network:GetLogTraffic() -- return tables

Fixed Queue System & Faster Queue workload

1 Like

hey I was adding this in bridgenet 2.0.0-rc4, is this function inspired from EasyNetwork?

also cool project!

3 Likes

MINOR UPDATE - v1.3 - Beta

now some function use Promise
Bugs Fixes and Improvements

1 Like

NEW UPDATE - v2.0 - Release

What new?

Now you no longer need :Init() to start the network, you can instantly use the module.

Added :WaitForListen(delay : number : optional) on :CreateRemote()
Example:

local Remote = FastNet:CreateRemote("RemoteEvent", "Remote1")
Remote:WaitForListen():Connect(function(plr, ...)
end)

Added something on Remote:Remove( string : message )
Example:

local Remote = FastNet:CreateRemote("RemoteEvent", "Remote1")
Remote:Remove("The remote is removed")

output-console-log:
> [FastNet]: The remote is removed

Now any connection network returns JSONEncoded string for the packet data compression, so to decode it use FastNet:Dec(any : JSONEncoded)
Example:

Remote:WaitForListen():Connect(function(plr, ...)
print(plr, FastNet:Dec(...))
end)

Now every max queue reached new queues will be rejected while queue is full

Now every Remotes Fired/Invoked the data_to_sent will be compressed to JSONEncode Format for smaller packet data (byte) taken [tested & compared)

Removed Promise (while having issue)

Bugs Fixes & Optimizes

Download here
FastNet.rbxm (6.3 KB)

2 Likes

image
Compare - Speedtest (FastNet v2.0-Release vs Native-Roblox vs BridgeNet 2.0.0-rc3)

BridgeNet receive highest sent byte (65-71kB/s, 98.7-113ms)
Native-Roblox (6.3-6.9kB/s, 967-1497ms)
FastNet (2.4-3kB/s, 71-94.3ms)
Benchmark using RunService.Heartbeat (no delations)
75 fires per frame

2 Likes

I still have some issues
gg
Yes

3 Likes

Fixed the bug/issue

Download newer here:
FastNet.rbxm (6.2 KB)

also thanks for reporting the issue :slight_smile:

2 Likes

Small Update - Quick Fix

Fixed an issue on queue from rateLimiter

Download here:
FastNet.rbxm (6.3 KB)

its also available on Roblox Library.

2 Likes

could we speak in private message, I’d like to know how to set it up (Im a bit slow i don’t really understand the tutorial) could you go into details, etc

2 Likes

added 2 more benchmark result (type: 30 & 125 fires per frame)

1 Like

benchmark 7 (completed, posted)

Small Update - v2.0-release (same version)

Now FastNet:Remove( nameRemote, message ) now support output message like Remote:Remove( message )

Small Fix
Download here
FastNet.rbxm (6.1 KB)

Added Benchmark 9 comparison (BridgeNet v2.0.0-rc4, FastNet v2.0-release, EasyNetwork (All Latest version))

NEW UPDATE - v2.1 - Release

Added :GetRemotes( typeRemote : string ) (Server & Client)
typeRemote mean like spesific type remote (RemoteEvent ? RemoteFunction)

print(FastNet:GetRemotes()) -- print remotes with table format {["RemoteName"] = SignalRemote}

Added :ClearRemotes() (Server)

Instead clear/destroy all remotes created on FastNet

return boolen value (true/false), true : successfuly cleared/destroyed all remotes created, false : there no any remotes available/exists

Changed default settings

RateLimiter > MaxLimit (35 → 75)
Queue > MaxQueue (50 → 500)

Shorten code lines (not much)
Bugs Fixes & Minor Performance optimized

Download here (v2.1-release):

FastNet.rbxm (6.8 KB)

Extra: New benchmark comparison soon (added to benchmark #10)

NEW UPDATE - v2.2 - Release


Added :AddLimit( player : Instance , MaxLimit : number, ResetTime : number ) (Server)
It’s like for anti spam for spesific player like RateLimiter

print(FastNet:AddLimit(player, 50, 1.5)) -- return {true/false} it will add into RateLimitPlayer list (not RateLimiter)

Added :RemoveLimit( player : Instance ) (Server)

Instead remove player from rateLimitPlayer list

return boolen value (true/false), true : successfuly removed the player from list, false mean player not in list or fail

Small Fix (not important)

Download here (v2.2-release):
FastNet.rbxm (8.6 KB)


IMPORTANT NOTE FOR THIS VERSION

USING :AddLimit(…) Function may increase SendPacket size and may reduce performance. so i suggest just use RateLimiter i made this function only if needed, keep stay on v2.1 if you dont need this function for you project!

RateLimiter & RateLimitPlayer aren’t same

NEW UPDATE - v2.3 - Release


Reduced Network Bandwidth Size (upto ~41-42% lower)

Our stress-benchmark test [125 fires/frame] (v2.3 vs v2.2): v2.3: ~6.36-7 kB/s (sent), v2.2: ~10.3-11.4 kB/s (sent)

Minor Performance Optimized (Faster Compress Enc & Dec)


*This update focused on bandwidth usages optimization

Download (FastNet v2.3):

FastNet.rbxm (9.8 KB)

Hey there, I’m awfully worried about the massive amount of updates you’re putting out, could you please try to compress these down or at least keep an officially LTS and production-ready version.

You’ve now semver’d up to 2.3 in 5 days of the project existing, so either you’re really unsure and I don’t feel safe using this, or you don’t know how to use semver to properly show your process.

Roblox-TS and Wally support would be nice and actually being able to see your code on GitHub would be a nice sign and of much use. Overall I’m not going to even contemplate using this until you refine everything and fix your practices, I’m sticking to BridgeNet.

Look into Rojo!

5 Likes

I also feel like I’m marching in uncharted territories attempting to use FastNet. I’d absolutely love a production-ready build, for now I’d probably stick to BridgeNet for the teensiest more stability.

6 Likes