Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

need redis protocol example like below #5

Open
kolinfluence opened this issue Feb 26, 2023 · 14 comments
Open

need redis protocol example like below #5

kolinfluence opened this issue Feb 26, 2023 · 14 comments
Labels
enhancement New feature or request

Comments

@kolinfluence
Copy link

need redis protocol example like below
https://github.com/IceFireDB/redhub

possible to replace redhub internal networking stuff with gain?

i can sponsor a few coffees for this.
p.s. : i can sponsor more coffees if u can do pub/sub features on it.

i was looking at your project for a long time and it's really amazing for u to have done so far. thank you

@pawelgaczynski
Copy link
Owner

Hi,

It looks like there shouldn't be much trouble replacing gnet with Gain. I'll try to do it for you in my spare time

@pawelgaczynski pawelgaczynski added the enhancement New feature or request label May 8, 2023
@pawelgaczynski
Copy link
Owner

Here you go, an example of using the Gain framework as a backend for the RedHub library:

https://github.com/pawelgaczynski/redhub

Not a perfect implementation, but it should be enough to understand how to use Gain.

@kolinfluence
Copy link
Author

cool! will test it out soon and revert with feedback.

@kolinfluence
Copy link
Author

kolinfluence commented May 25, 2023

redgain is a bit slower. why? ran the example folder code

redis-benchmark -p 6380 -t get,set -n 100000 -q

redhub:
SET: 54288.82 requests per second, p50=0.431 msec
GET: 56022.41 requests per second, p50=0.423 msec

redgain:
SET: 50505.05 requests per second, p50=0.455 msec
GET: 53475.94 requests per second, p50=0.431 msec

@kolinfluence
Copy link
Author

@pawelgaczynski the version of server in example folder is eating around 10% of cpu core doing nothing. why?

@pawelgaczynski
Copy link
Owner

@kolinfluence please provide the specifications of the host on which you tested it (CPU, Linux, kernel).

@kolinfluence
Copy link
Author

kolinfluence commented May 28, 2023

@pawelgaczynski

  1. i5-4300U
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=22.04
    DISTRIB_CODENAME=jammy
    DISTRIB_DESCRIPTION="Ubuntu 22.04.1 LTS"

  2. Intel(R) Core(TM) i5-2400 CPU @ 3.10GHz
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=22.04
    DISTRIB_CODENAME=jammy
    DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"

@pawelgaczynski
Copy link
Owner

Please provide the kernel versions of both machines. You can check it with uname -r command. Did you test redgain by always running the client and server on the same machine?

@kolinfluence
Copy link
Author

kolinfluence commented Jun 8, 2023

@pawelgaczynski sorry for the missed reply

i5-4300U
Linux 5.15.0-73-generic #80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

i5-2400
Linux 5.15.0-69-generic #76-Ubuntu SMP Fri Mar 17 17:19:29 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

  1. possible to advise what kernel version to use?
  2. isnt it more accurate to use a separate client / server to test?
    i'm not very sure but will try again.

@kolinfluence
Copy link
Author

@pawelgaczynski can u pls clean up your version of redhub repo so i can try again? thx

# go mod tidy
go: finding module for package github.com/pawelgaczynski/gain
go: finding module for package github.com/rs/zerolog
go: finding module for package github.com/pawelgaczynski/redhub
go: finding module for package github.com/pawelgaczynski/redhub/pkg/resp
go: found github.com/pawelgaczynski/gain in github.com/pawelgaczynski/gain v0.3.1-alpha
go: found github.com/pawelgaczynski/redhub in github.com/pawelgaczynski/redhub v0.0.0-20230525152746-f48c208a8ab1
go: found github.com/pawelgaczynski/redhub/pkg/resp in github.com/pawelgaczynski/redhub v0.0.0-20230525152746-f48c208a8ab1
go: found github.com/rs/zerolog in github.com/rs/zerolog v1.29.1
go: redgain imports
	github.com/pawelgaczynski/redhub: github.com/pawelgaczynski/[email protected]: parsing go.mod:
	module declares its path as: github.com/IceFireDB/redhub
	        but was required as: github.com/pawelgaczynski/redhub
root@ubuntu-22:/home/ubuntu/Documents/Programs/redgain/example# grep -rnH 'IceFireDB' .
root@ubuntu-22:/home/ubuntu/Documents/Programs/redgain/example# 

@kolinfluence
Copy link
Author

can you please modify this also?
https://github.com/tidwall/redcon
as it has more features

@pawelgaczynski
Copy link
Owner

  1. possible to advise what kernel version to use?

As io_uring is in active development it is worth using or at least testing performance on the latest possible kernel version. If my spare time permits, I intend to compare gain performance on all official kernel versions from 5.15 upwards.

  1. isnt it more accurate to use a separate client / server to test?

Yes, it is. Client and server on one machine is hardly a common use case for web applications. If you test on separate machines then please indicate which one was the server.

@pawelgaczynski can u pls clean up your version of redhub repo so i can try again? thx

Done.

can you please modify this also?

I'll have a look at it and let you know. I can't promise if and when I'll be able to do it for you, but I'll try.

@kolinfluence
Copy link
Author

kolinfluence commented Jun 10, 2023

@pawelgaczynski

Intel(R) Core(TM) i3-8145U CPU @ 2.10GHz
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.2 LTS"

Linux ubuntu-22 5.19.0-43-generic #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon May 22 13:39:36 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

GOMAXPROCS=1 ./server
redhub:
SET: 149499.17 requests per second
GET: 150353.33 requests per second

redgain:
SET: 138869.59 requests per second
GET: 138159.72 requests per second

using single core performance test. redhub is faster. running redisbenchmark and server on same laptop.
it also eats 16-20% cpu being idle, doing nothing

@hiqsociety
Copy link

@pawelgaczynski you dont have to benchmark against all kernel version it has been done here, which obviously says the higher kernel version, the faster io_uring performs
uNetworking/uWebSockets#1603

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants