News for hackers. Stuff that matters.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by contrarian_ on Saturday January 06, 2018 @06:49AM (#16084878)
Pretty much what I predicted here: https://news.ycombinator.com/item?id=16054674

> Sounds like servers handling lots of small UDP packets would be hit pretty hard.

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by _wmd on Saturday January 06, 2018 @07:23AM (#16084976)
There's potential for a little rearchitecting to help, at least in the case of UDP:

    NAME
           sendmmsg - send multiple messages on a socket

    SYNOPSIS
           #define _GNU_SOURCE          /* See feature_test_macros(7) */
           #include <sys/socket.h>

           int sendmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen,
                        unsigned int flags);
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by jacquesm on Saturday January 06, 2018 @07:56AM (#16085085)
That only works if messages are independent of answers received and are all known at the same point in time. In most games this typically would not be the case, you'd use a message to cram as much state change into it as is known to keep the game moving fluidly. Packing more than one such message together would serve no purpose.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by _wmd on Saturday January 06, 2018 @08:53AM (#16085232)
I'd have presumed otherwise, but I'm not sure if you're understanding the API correctly.. it's not about sending multiple messages to the same destination, but to multiple destinations in a single call. The msg_hdr struct has room for specifying the target address.

From userspace' perspective, even if the same data isn't being broadcast at every client, just building up a big array (perhaps while looping over the input from recvmmsg()!) and spitting it out once would have the same semantics as just calling sendmsg() immediately on each, etc

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by jacquesm on Saturday January 06, 2018 @09:01AM (#16085265)
Yes, I understand the API correctly. Having implemented it once I think I have the basics down ;) But that said I was assuming that this would be in the context of multiple UDP messages sent from a game client to a game server.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by Doxin on Friday January 12, 2018 @09:40AM (#16133087)
The bottleneck generally isn't at the client side for games, The server has much more network traffic to handle. So even if this performance fix only works server-side that might be enough.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by EgoIncarnate on Saturday January 06, 2018 @01:37PM (#16086725)
It's pretty common for FPS server game loops to read all the network packets, update player state, run one tick of game logic and physics for all users in a single game, and then send out updates to everyone.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by vvanders on Saturday January 06, 2018 @03:38PM (#16087317)
Yup, this is pretty much on the mark. Game updates are sent at a fixed rate(usually 10-20Hz) so you could batch up all outgoing game state into a single dispatch. It'd probably take a bit of work re-architect the output loop(pre-allocate for max number of players to avoid per-frame allocations) but should be reasonably straightforward to implement in most engines.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by jacquesm on Saturday January 06, 2018 @04:59PM (#16087714)
Server side, yes. Client side, not so much.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by zzzcpan on Saturday January 06, 2018 @08:32AM (#16085168)
If they are using socket API for UDP, performance is not critical for them. Otherwise porting UDP servers to DPDK/netmap is not rocket science and gets you like an order of magnitude better performance.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by snuxoll on Sunday January 07, 2018 @12:47AM (#16089466)
A shooter running at 30Hz (high side for free developer sponsored servers) with even 100 players is only going to be processing at most 10-15K packets per second, and that’s assuming 5 packets per tick per player. Server update rates are usually lower than the internal physics and game logic tick rate as well, so it’s doubtful to even be that high.

These aren’t stats of the gameplay servers, these are the backend servers that handle matchmaking, player stats, inventories and progression.

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by alfanick on Saturday January 06, 2018 @08:19AM (#16085136)
Or use userspace networking stack (with cards which allow this) to reduce number of syscalls.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by gpderetta on Saturday January 06, 2018 @08:25AM (#16085149)
Especially for UDP this would work very well (as there isn't much of a network stack anyway).
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by ckocagil on Saturday January 06, 2018 @08:41AM (#16085190)
And solve the C10M problem at the same time. Two birds with one stone.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by forgotpw2018 on Saturday January 06, 2018 @10:19AM (#16085596)
You could use it, but you would probably have to reachitect the server to use green threads to avoid the overhead. Frequent syscall sends are done with games to keep the latency as low as possible. Any batching would increase delay
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by contrarian_ on Saturday January 06, 2018 @07:34AM (#16085007)
Yep, I was actually debating whether I'd mention sendmmsg/recvmmsg in my original post but I left it out. Definitely an option for UDP, but you're out of luck if your game server uses TCP (surprisingly many do) because you have to recv from each socket separately.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by _wmd on Saturday January 06, 2018 @07:38AM (#16085014)
There may still be some options depending on the structure of your server and where the added CPU load is hurting most, for example, shunting IO to a thread/threadpool where futex() calls (if necessary) only occur for every N IO requests, rather than pay the syscall price for every IO on the main thread. But that might introduce new latency/ordering problems all of its own
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by dogma1138 on Saturday January 06, 2018 @09:04AM (#16085283)
The majority of online games use TCP these days with good prediction it’s more reliable than UDP.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by Demiurge on Saturday January 06, 2018 @11:21AM (#16085877)
Latency is more important than reliability for online gaming because the world state instantly gets stale. Instead of retransmit you want latest snapshot. I'd be curious to find out in what online games that is not the case.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by dogma1138 on Saturday January 06, 2018 @12:13PM (#16086188)
Latency isn’t an issue today what so ever, it’s not like UDP also has a magical lower latency it had in the past because of smaller packets and slower computers but today?

Online games work today with fixed ticks and polling usually at half of full frame rate which means that the server updates and polls the client 30 or 60 times a second or any other even multiplier of the expected synced frame rate.

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by Matheus28 on Saturday January 06, 2018 @12:45PM (#16086442)
>This fixed and predictable rate pretty much means that UDP is near pointless and games that still don’t have a predictable tick rate and use UDP tend to be a rubber banding lag fest.

You're wrong. Head of line blocking is a real thing that happens very often in TCP.

Edit: parent poster removed that part of the comment between me reading and submitting a reply

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by vvanders on Saturday January 06, 2018 @01:19PM (#16086631)
Nope, sorry but you're completely wrong on this. UDP is better because head of line blocking will causes large delays during packet loss.

Source: I used to write networking stacks for realtime games.

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by bschwindHN on Saturday January 06, 2018 @12:37PM (#16086374)
I'm calling bullshit. TCP has to retransmit lost packets whereas UDP can keep on going without waiting for transmission. Ephemeral data like controller input or past game states can be ignored because that time has passed, while TCP is still trying its best to get the packets there in order and reliably.

Latency is still absolutely an issue. I play games from Japan with my friends in the states and I often have a ping of 140 ms or so. That is latency, and properly implemented games (Rocket League, for example) will deal with it using UDP among other techniques.

Slower paced games can still use TCP though because latency issues are less sensitive.

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by EgoIncarnate on Saturday January 06, 2018 @01:44PM (#16086753)
It really depends on the type of game.

If it's a latency sensitive (like a twitch FPS), UDP is the way to go. Having up to date data is more important than having all the data.

If it's a synchronized game (like a turn based game or an RTS where all clients run at the same logic framerate), or not latency sensitive (an MMO like WOW), TCP is fine and probably easier.

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by dogma1138 on Saturday January 06, 2018 @09:12AM (#16085313)
Fortnite doesn’t use UDP at all (80, 443 and 5222 all TCP), UE4 uses TCP for its network stack by default.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by vvanders on Saturday January 06, 2018 @03:34PM (#16087300)
Nope, it might use TCP for negotiation of things that aren't time sensitive but it uses UDP for replication[1] as has pretty much every Unreal or Quake based engine since they were first developed.

I've worked on a variety of engines which were either UE or Quake based. All of them use UDP for temporal game state updates to avoid head of line blocking[2][3].

[1] https://answers.unrealengine.com/questions/197713/is-replica...

[2] https://stackoverflow.com/questions/39323556/why-do-game-dev...

[3] https://www.gamasutra.com/view/feature/131781/the_internet_s...

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by kevindqc on Saturday January 06, 2018 @12:57PM (#16086507)
Are you sure? I would be extremely surprised if it wouldn't use UDP.

For things like getting stats, probably from a HTTP endpoint, sure, but for gameplay? The lag would be very bad, no? Lose a packet and everything is slowed down

I see this, which indicates it uses UDP: https://imgur.com/al6KTwT

and according to wireshark it's used heavily when in a game, so I assume that's the gameplay protocol. Also when I left my game (but stayed in the lobby), immediately the port 61879 stopped listening.

I'm not sure about UE4, but previous versions of the unreal engine used UDP for replication and RPC.

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by dijit on Saturday January 06, 2018 @02:29PM (#16086991)
It's not entirely uncommon to have TCP on the backend even for AAA games.

I worked on a huge open world third-person shooter always-online AAA game and it uses TCP for everything.

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by kevindqc on Saturday January 06, 2018 @02:43PM (#16087040)
Interesting. I know World of Warcraft uses TCP, but I imagine it's less "real-time" than shooters (ie: no hitscan) so a few dropped packets wouldn't have a huge impact (ie. if you're standing casting a spell for 2sec, the game can recover the lag easily). Didn't know some shooters used TCP
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by tgb on Saturday January 06, 2018 @07:41AM (#16085027)
Since they describe this as log-in issues, should we expect that to be a server using lots of UDP? Or do you think that the log-in service is hemmed in by the load on the game servers?
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by dogma1138 on Saturday January 06, 2018 @09:42AM (#16085448)
No, login in Fortnite is over 443 and it uses normal HTTPS.

It also uses HTTPs to load a lot of other data such as server data, friends list, chat etc.

Unreal Engine comes with a version of chromium built in which is used for many in game things like social tabs, news, and in game purchases these all work over HTTP/S.

Game data is sent over 5222 TCP.

Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by tgb on Saturday January 06, 2018 @12:08PM (#16086151)
Right, that's what I was guessing and am not sure why I was downvoted when everyone is confirming that contrarian's post doesn't really make sense since UDP isn't very relevant here.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by jbg_ on Saturday January 06, 2018 @10:48AM (#16085721)
Out of interest, do you know if the game data uses XMPP or if it just uses the same port?
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by dogma1138 on Saturday January 06, 2018 @12:14PM (#16086198)
5222 is pretty much used for all Epyc games I don’t think that I has anything to do with XMMP tho.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by one_thawt on Saturday January 06, 2018 @10:54AM (#16085745)
It does not. It's all based on the UE4 network stack.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by Thaxll on Saturday January 06, 2018 @11:13AM (#16085844)
Gameservers don't handle that many packets because they're limited in the number of player they host. A game a 60hz with 64 players will only receive 3840 packets/sec.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by johnbellone on Saturday January 06, 2018 @11:51AM (#16086046)
I don’t know the game or the engine, but if this is a login service, this is likely traffic from all of the players.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by abstractbeliefs on Saturday January 06, 2018 @11:53AM (#16086054)
And then it has to communicate new state to those 64 players 60 times a second for another 3840 reaching 7680 packets per second.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by dxhdr on Saturday January 06, 2018 @09:04PM (#16088661)
And then how many game servers can you run on a machine? Hopefully a lot more than just one.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by mtgx on Saturday January 06, 2018 @09:57AM (#16085501)
I wonder if this means Google's QUIC protocol is dead in the water, since it works over UDP.
Re:CPU Usage Differences After Applying Meltdown Patch at Ep... by dsign on Saturday January 06, 2018 @10:00AM (#16085516)
You can basically have bigger UDP packets, that will get fragmented and may not make it to their end.

As far as I know, in Linux there is no support for multi-packet UDP vectored I/O. I wonder if it would be possible to "simulate" that with a raw socket....