News for hackers. Stuff that matters.
Re:BGP Implemented in Go by freedomben on Saturday March 19, 2022 @03:37PM (#30736904)
Maybe a dumb question nowadays because I stopped using Go around the 1.6 days, but is there still a stop-the-world garbage collector, or any other potential blockers for high performance/real time?

A previous company I worked with chose to build in C++ instead of Go because of that, as the performance requirements were very, very high. I would imagine a serious BGP usage would have very high requirements?

Re:BGP Implemented in Go by woah on Saturday March 19, 2022 @04:22PM (#30737256)
BGP doesn't have very high performance requirements. It does not handle any internet traffic. All it does is configure the kernel routing tables. Even if there's some crazy 1 second GC pause it will not greatly affect the performance of the router.
Re:BGP Implemented in Go by lima on Saturday March 19, 2022 @04:54PM (#30737510)
Sending or receiving an internet full table (and potentially applying filters/aggregations) is still quite performance intensive, since it needs to happen quickly.

A one-second GC pause won't hurt you but managing the necessary data structures in memory can be challenging.

Anecdotally, gobgp is quite a bit slower than hand-optimized C implementations like frr (not that it matters for most gobgp use cases).

Re:BGP Implemented in Go by Karrot_Kream on Saturday March 19, 2022 @07:18PM (#30738447)
> A one-second GC pause won't hurt you but managing the necessary data structures in memory can be challenging.

How so? It's a very common pattern in garbage collected languages to preallocate an array or structures and read/write into it, then "release" the array on finishing the function.

Re:BGP Implemented in Go by mike_d on Sunday March 20, 2022 @02:46AM (#30740683)
> Sending or receiving an internet full table (and potentially applying filters/aggregations) is still quite performance intensive

Nope. I am running 15 sessions with full transit tables, multiple exchanges, and private peers on a four core ARM CPU with 4 GB of RAM.

Re:BGP Implemented in Go by lima on Sunday March 20, 2022 @02:44PM (#30745373)
How does it take to receive a full table?
Re:BGP Implemented in Go by mike_d on Sunday March 20, 2022 @04:56PM (#30746529)
How long? If I down all the peers and bring them up it will take 5-10 seconds to rebuild. But if you do that you're scheduling an outage anyway.
Re:BGP Implemented in Go by tptacek on Saturday March 19, 2022 @05:32PM (#30737763)
What's challenging about it? Go gives you control over the layout of your objects in memory.
Re:BGP Implemented in Go by remram on Saturday March 19, 2022 @04:22PM (#30737262)
I don't think BGP requires real-time. Increasing throughput via multithreading is probably much more impactful (for large deployments) and otherwise it doesn't matter.
Re:BGP Implemented in Go by tptacek on Saturday March 19, 2022 @06:26PM (#30738113)
A BGP route server might be the platonic ideal of a Go problem: it's demanding enough not to be tenable in Python, but not real-time or kernel resident, and mostly data structure --- and just a couple data structures --- intensive.
Re:BGP Implemented in Go by justinsaccount on Saturday March 19, 2022 @07:48PM (#30738631)
> not to be tenable in Python

https://github.com/Exa-Networks/exabgp is written in python

Re:BGP Implemented in Go by tptacek on Saturday March 19, 2022 @08:23PM (#30738804)
Sorry, I wasn't being precise. Lots of people use BGP for easy lifts, like internal policy routing inside data centers (I find this mystifying but whatever) or simply to advertise Anycast prefixes to upstreams. I was thing more about doing default-free global Internet routing with multiple peers.
Re:BGP Implemented in Go by justinsaccount on Saturday March 19, 2022 @08:32PM (#30738851)
I've used exabgp running on a small VM to inject 300,000 /32 routes to multiple peers. Not quite the size of the full v4 routing table, but not too far off either.
Re:BGP Implemented in Go by tptacek on Saturday March 19, 2022 @10:09PM (#30739390)
Were you taking a feed in? Or just publishing your own addresses?
Re:BGP Implemented in Go by justinsaccount on Sunday March 20, 2022 @10:39AM (#30742972)
just injecting routes. There are a bunch of looking glass implementations that use exabgp though.
Re:BGP Implemented in Go by natefinch on Saturday March 19, 2022 @07:49PM (#30738638)
Go's garbage collector has super short stop the world now, about 1ns IIRC. Most of the work is done concurrently from the main process threads.
Re:BGP Implemented in Go by d110af5ccf on Saturday March 19, 2022 @11:19PM (#30739766)
> 1ns

Microsecond, perhaps. Likely millisecond. Nanosecond is faster than a single CPU instruction.

Re:BGP Implemented in Go by mitchs on Saturday March 19, 2022 @04:16PM (#30737186)
It depends on the context. Not every bgp speaker needs the full internet table and frequent route changes. If you use the network to balance traffic across servers, you just need a bgp speaker on a server to inject a few routes for the ip addresses it will handle. In that case a good api outweighs performance.