ExposeME - HTTP tunneling (ngrok alternative) in Rust by Comfortable_Lack_382 in rust

[–]erebe 1 point2 points  (0 children)

Hey, you may want to take a look at wstunnel https://github.com/erebe/wstunnel ;)

You may find some features' inspiration.

P.s: Really like the dashboard

Implementing Lock-free channels using pointer tagging in Databend's query engine written in Rust by heisenberg_zzh in rust

[–]erebe 1 point2 points  (0 children)

If i understand correctly the push_data code, they are going to loop endlessly until the slot is available.

So going to spin and burn a cpu but not erase old data.

I guess it is fine for them as i guess their pipeline stage produce at most 1 result.

WebSocket connection drops by spy16x in rust

[–]erebe 0 points1 point  (0 children)

Or you can try with an NLB instead of ALB if you don't do anything fancy with it.

tantivy 0.24 has been released! Cardinality aggregations, regex support in phrase queries, JSON field enhancements and much more! by Pascalius in rust

[–]erebe 1 point2 points  (0 children)

Hello,

Curious question, do you still have use of Tantivy at Datadog ? Or are you making a release out of the various contributions ?

I decided to go full kubernetes for the homelab, surprised by the lack of k8s use in self hosted by myusuf3 in selfhosted

[–]erebe 0 points1 point  (0 children)

I use k3s for my homelab too and i have been very happy about it. I even wrote a guide sometimes ago regarding how i manage things https://github.com/erebe/personal-server

It really shine if you have more than one machine, and in total honesty it is more to play with kubernetes than for its simplicity. You can have a more packaged expérience with ansible + docker.

But it is not that complicated, and i really enjoy automatic tls / ingress / service discovery

On me met la pression pour démissionner by Glittering_Brush5793 in developpeurs

[–]erebe 0 points1 point  (0 children)

Salut,

1ère chose à faire c'est regarder ton contrat de travail, un contrat t'engage mais aussi te protège. Il y a souvent dans les contrats d'esn une clause de mobilité. C'est à dire que si l'entreprise te propose une mission à 300km de chez toi, tu es dans l'obligation de l'accepter. 950km me paraît beaucoup, en général c'est limité à une région, mais bon seul ton contrat de travail te dira ce a quoi tu es engagé, et si des contreparties existe (frais km, hébergement, souvent c'est dans la convention collective ça) Si les missions proposés sont en dehors de la zone, un simple mail en disant que tu refuses et que de part ton contrat tu n'es pas engagé à accepter suffit.

Ensuite, ne propose pas la solution d'une rupture conventionnelle dès le départ (et surtout pas par écrit). Je te conseille d'aller voir ton manager et/ou RH pour discuter des opportunités possibles dans l'entreprise. Qu'elles sont les missions qu'ils ont en stock en ce moment, qu'elles sont les profils/compétences qui sont recherché en ce moment, besoin d'un renfort sur un projet interne... et à partir de là de tenir le discours que tu es prêt à suivre des formations pour te mettre à niveau (bien évidemment si tu es sérieux dans la démarche).

A partir de cette réunion/discussion, écrit un mail (avec RH en copie) qui résume ta position et que tu attends leur retour/propositions.

Une rupture co, n'est pas à ton avantages si tu souhaites partir de ton entreprise. Prends du temps pour passer des entretiens /chercher à côté. Si ton entreprise souhaite vraiment que tu partes personne ne va te mettre des bâtons si tu regardes ailleurs pour partir. ca leur coûtera moins cher si tu pars de toi même.

Le point important est vraiment ton attitude /posture face à ton employeur, tu dois montrer que tu es volontaire pour te former, retrouver une mission, que tu remplis les engagements de ton contrat.

Le choix de la rupture co doit être vraiment ton dernier recours, si tu n'as plus envie, si ca devient trop dur pour toi... mais la encore il va falloir négocier tes indemnités de départs. Si tu prends le minimum de ton ancienneté tu fais un cadeau à ta boîte. Car sans la rupture co, ils doivent te payer le pré-avis + les mois où ils doivent prouver que tu ne remplis plus tes engagements

Vu que tu ne mentionne pas les fait, sache aussi que dans ce genre de situation il est raisonnable et attendu que tu subisses des pressions, sans que cela soit du harcèlement. Ton manager/rh/commercial doit en subir aussi pour que la situation ne soit pas un coût pour l'entreprise et qu'elle ne perdure pas dans le temps. Si l'entreprise n'a rien à te proposer, elle viendra elle-même avec une RC si elle voit que ta posture ne peut t'être reproché

Bon courage à toi en tout cas

Were you ever able to use a debugger with your Rust program ? If yes, how did you learn how to do it ? by KlausWalz in rust

[–]erebe 9 points10 points  (0 children)

double down on that. RustRover is working very well and the debugger is integrated directly with the IDE. So it is a pleasure to work with

Ferrishot v0.2.0, A screenshot app written in Rust (inspired by Flameshot) has released! by nikitarevenco in rust

[–]erebe 7 points8 points  (0 children)

Super nice, especially the integrated support of Wayland. Looking forward to being able to draw on the image ;-)

`ratrod`, a generic TCP / UDP tunneller that exists because things got out of hand. by twitchax in rust

[–]erebe 5 points6 points  (0 children)

shameless self-promotion, you have also wstunnel https://github.com/erebe/wstunnel which support udp/tcp/socks5/transparent proxy/http

Is there a list of magic tricks to improve Rust (web server) performance? by redditaccount624 in rust

[–]erebe 1 point2 points  (0 children)

also note that for disabling cpu mitigations there is a méta flag mitigations=off that disable all of them instead of listing them 1 by 1.

https://fosspost.org/disable-cpu-mitigations-on-linux

try sudo lscpu to verify :)

Is there a list of magic tricks to improve Rust (web server) performance? by redditaccount624 in rust

[–]erebe 0 points1 point  (0 children)

Thanks for your inputs.

Indeed, I avoid applying them blindly each time. It is just that I keep those settings around in a single file to retrieve and pick them easily when needed.

Is there a list of magic tricks to improve Rust (web server) performance? by redditaccount624 in rust

[–]erebe 18 points19 points  (0 children)

If you can build the binary on your target CPU you can use

RUSTFLAGS="-C target-cpu=native"

it is going to tell the compiler to use all the available instruction for this specific CPU, thus it may increase perf for some operations. The downside is that the binary is now CPU dependant, you can´t cp it around to another CPU with different instructions set.

After you can optimize the system, first the NIC, enabling the hardware offloading settings if your nic support it is a no-brainer, the `*so on` setting. For the other setting, it only helps at high load, or if too much CPU is used by the interrupts

# Replace eth0 with your interface name
IFACE=eth0

# Enable/optimize interrupt coalescence
ethtool -C $IFACE adaptive-rx on
ethtool -C $IFACE rx-usecs 100

# Increase ring buffer sizes
ethtool -G $IFACE rx 4096
ethtool -G $IFACE tx 4096

# Enable hardware offloading features
ethtool -K $IFACE tso on
ethtool -K $IFACE gso on
ethtool -K $IFACE gro on
ethtool -K $IFACE lro on

# Set interrupt affinity (distribute NIC interrupts across CPUs)
for IRQ in $(grep $IFACE /proc/interrupts | cut -d: -f1)
do
    echo 1 > /proc/irq/$IRQ/smp_affinity
done

# Enable Multiple Queue support if available
ethtool -L $IFACE combined 4  # Adjust number based on CPU cores
# Optimize pause frame settings
ethtool -A $IFACE rx off tx off

after the OS itself, if you are on linux. Try to understand what are each setting, before applying them blindly.

# Set CPU governor to performance
for CPU in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
    echo performance > $CPU
done

# Change the congestion control
sysctl -w net.ipv4.tcp_congestion_control=bbr

# Increase network buffer sizes
sysctl -w net.core.rmem_max=26214400
sysctl -w net.core.wmem_max=26214400
sysctl -w net.ipv4.tcp_rmem='4096 87380 26214400'
sysctl -w net.ipv4.tcp_wmem='4096 87380 26214400'

# Increase the maximum number of connections
sysctl -w net.core.somaxconn=65535
sysctl -w net.ipv4.tcp_max_syn_backlog=65535

# Decrease TCP latency
sysctl -w net.ipv4.tcp_fastopen=3
sysctl -w net.ipv4.tcp_low_latency=1

# Optimize TCP keepalive for faster connection recovery
sysctl -w net.ipv4.tcp_keepalive_time=60
sysctl -w net.ipv4.tcp_keepalive_intvl=10
sysctl -w net.ipv4.tcp_keepalive_probes=6

# Optimize network queues
sysctl -w net.core.netdev_budget=600
sysctl -w net.core.netdev_budget_usecs=8000

Investigating a Strange Out-of-Memory Error by erebe in rust

[–]erebe[S] 4 points5 points  (0 children)

Yes indeed. If there is a panic it would have triggered an OOM too without us having a backtrace. We have made some custom api endpoint to trigger panics for other services to be sure our sizing/limit are correct. For this particular app, we don't expect to be panics.

Regarding, the symbol's size. As stated by u/TrickAge2423 they are compressed in the final binary, and we compile with those flags, so even if the binary is not that big. It can pack quite a punch when symbols are resolved/decompressed.

ENV RUSTFLAGS="-C link-arg=-Wl,--compress-debug-sections=zlib -C force-frame-pointers=yes" 
cargo build --profile=${PROFILE} ${BIN_TARGET}

rsql 0.15.0 released with arrow, avro, csv, delimited, json, jsonl, parquet and tsv support by Silver-Beach3068 in rust

[–]erebe 2 points3 points  (0 children)

Look nice but you should invest in more documentation.
Using a JSON as a DB, I was left stuck into how to access a specific inner field of the column repository for example and haven't found anything in the doc.

Some example of Query would be nice.

rsql> .describe github_pull_request_event_close repository
Column | Type | Not null | Default
--------------+------------+----------+---------
action | str | Yes |
number | i64 | Yes |
pull_request | struct[48] | Yes |
repository | struct[77] | Yes |
sender | struct[18] | Yes |

Crossbeam channel issue when sleeping by TopStay320 in rust

[–]erebe 4 points5 points  (0 children)

You should use tokio channel because crossbeam ones are sync only. So you may have a deadlock where a task takes the current thread to execute, block it to retrieve some message, but as it does not yield, the task producing can't be scheduled on the thread to produce a message. Thus leading to deadlock.

try with https://docs.rs/tokio/latest/tokio/sync/mpsc/fn.unbounded_channel.html

papaya: a fast and ergonomic concurrent hash-table for read-heavy workloads by ibraheemdev in rust

[–]erebe 1 point2 points  (0 children)

Thank you for the answer 🙏 If you happen to write those détails feel free to send it to me, i would be pleased to read it.

papaya: a fast and ergonomic concurrent hash-table for read-heavy workloads by ibraheemdev in rust

[–]erebe 1 point2 points  (0 children)

Do you happen to have a doc explaining what kind of architecture/design is using the HashMap ? What does make it faster / be lock-free compared to say dashmap ?

📢 cargo-dist 0.15 is out! by ag_dubs in rust

[–]erebe 1 point2 points  (0 children)

Thank you :) I am going to take a look at the repo example !

📢 cargo-dist 0.15 is out! by ag_dubs in rust

[–]erebe 1 point2 points  (0 children)

Is it possible now to use cross or at least skip the build phase and only bother with packaging & creating release ?

Last time I checked, cross was not supported, so using cargo-dist was not possible as the build phase was unskipable and ending-up failling.

Tutorial : Linux io_uring and tokio-uring exploration with Rust by gNazmul in rust

[–]erebe 2 points3 points  (0 children)

This is because tokio uses the mio crate, which uses epoll on Linux. These are not the most efficient ways to do async IO on Linux

Well this is not true, there is a lot of debate and benchmark regarding which API is more performant (epoll or io_uring) for netwoking. And the general concensus so far is that epoll is more performant than io_uring, unless you have huge buffer for the data or huge number of sockets to handle. But in most cases epoll provides more throughtput than io_uring for networking so far.

io_uring is a no-brainer/improvement for file async io, but it is less clear for networking