I am prototyping an RTSP server in golang on Windows 64 bits. Right now I am using
github.com/wernerd/GoRTP/src/net/rtp to manage the RTP stream. I have one stream sending to multiple remote destinations (100 destinations and I want 1000). I am having a performance issue with UDPConn.WriteToUDP. I have profiled the application and it seems the problem is not with the UDP WSASendTo but with runtime.cgocall_errno.
If someone has a suggestion to get better performance, please let me know.
(pprof) top 20
86.59s of 92.05s total (94.07%)
Dropped 221 nodes (cum <= 0.46s)
Showing top 20 nodes out of 39 (cum >= 0.62s)
flat flat% sum% cum cum%
72.98s 79.28% 79.28% 74.22s 80.63% runtime.cgocall_errno
8.33s 9.05% 88.33% 8.33s 9.05% runtime.osyield
1.99s 2.16% 90.49% 1.99s 2.16% runtime.stdcall6
0.49s 0.53% 91.03% 0.58s 0.63% runtime.mallocgc
0.48s 0.52% 91.55% 0.48s 0.52% runtime.stdcall5
0.24s 0.26% 92.15% 75.81s 82.36% net.(*ioSrv).ExecIO
0.23s 0.25% 92.40% 0.77s 0.84% net.ipToSockaddr
0.18s 0.2% 92.59% 2.55s 2.77% runtime.netpoll
0.15s 0.16% 92.93% 0.49s 0.53% runtime.deferreturn
0.15s 0.16% 93.09% 8.10s 8.80% schedule
0.14s 0.15% 93.24% 74.30s 80.72% net.func·027
0.13s 0.14% 93.38% 75.94s 82.50% net.(*netFD).writeTo
0.12s 0.13% 93.51% 0.51s 0.55% runtime.netpollWait
0.12s 0.13% 93.64% 74.16s 80.56% syscall.WSASendto
0.11s 0.12% 93.76% 0.67s 0.73% runtime.newobject
0.10s 0.11% 93.87% 73.87s 80.25% syscall.WSASendTo
0.09s 0.098% 93.97% 8.04s 8.73% findrunnable
0.09s 0.098% 94.07% 0.62s 0.67% net.(*pollDesc).Wait