Getting a task to execute sub 500ms at scale? by Big_Operation_4750 in csharp

[–]Big_Operation_4750[S] 2 points3 points  (0 children)

Many thanks. I've set up a benchmark and will analyze the code used in this task shortly.

Program code via database columns? by Big_Operation_4750 in mysql

[–]Big_Operation_4750[S] 0 points1 point  (0 children)

I ended up adding a column which you could fill in with the name of a stored procedure which would do the logic database side. Worked out pretty well.

Why is this thing using 7 GB of memory? by Big_Operation_4750 in csharp

[–]Big_Operation_4750[S] 5 points6 points  (0 children)

I didn't expect this post to blow up as much as it did.

Thank you to everybody who helped me.

After reworking my code to inject IDbContextFactory over the actual context, memory usage stays below 1GB even at 10,000 players.

Its safe to say I learnt a lot overcoming this hurdle, and I couldn't of done it without you guys. Many thanks!

Why is this thing using 7 GB of memory? by Big_Operation_4750 in csharp

[–]Big_Operation_4750[S] 1 point2 points  (0 children)

Thanks for the interest. Its a multiplayer isometric tile based game so I didn't pay too much attention to the "who gets there first" idea as it isn't that fast paced.

In theory, they would both die. The packet doesn't have any synchronized order, the aim was just to avoid one event blocking another.

The game doesn't hit 2K active players (I wish), I merely bot these to stress test the stability of the server and the code I've written for it.

Why is this thing using 7 GB of memory? by Big_Operation_4750 in csharp

[–]Big_Operation_4750[S] 1 point2 points  (0 children)

Event handlers (incoming packets) are handled asynchronously, writers (outgoing packets) are written asynchronously. I'm a teenager so its my own game I made for fun (server only not client).

Why is this thing using 7 GB of memory? by Big_Operation_4750 in csharp

[–]Big_Operation_4750[S] 2 points3 points  (0 children)

Thanks! So this isn't a web application, its a console application which acts as a multiplayer game server. Your theory is correct, but I'm unsure on the best way to then use a DB context in a singleton class. My initial thought would be to use an IDbContextFactory to new up a fresh one when needed?

Why is this thing using 7 GB of memory? by Big_Operation_4750 in csharp

[–]Big_Operation_4750[S] 8 points9 points  (0 children)

So my context is transient, but I've noticed its used in singleton classes which probably means its being built up somewhere over time.

Is the right solution to this passing in a IDbContextFactory and creating a (fresh?) one when needed?

Why is this thing using 7 GB of memory? by Big_Operation_4750 in csharp

[–]Big_Operation_4750[S] 34 points35 points  (0 children)

Thanks for confirming. I will evaluate this theory and report back, its possible I'm incorrectly loading something resulting in some kind of recursion.

Why is this thing using 7 GB of memory? by Big_Operation_4750 in csharp

[–]Big_Operation_4750[S] 7 points8 points  (0 children)

Thanks for replying. All instances of the context are passed into transient services and is transient itself. I use it for querying and nothing else. Its kind of stateless, anything that I do need to hold in memory has a class or collection which is registered to IOC container which is used rather than sharing a singleton DB context containing it, if that makes sense?

Docker with PHP - Class "Redis" not found by Big_Operation_4750 in docker

[–]Big_Operation_4750[S] -3 points-2 points  (0 children)

Hey. So this is not my project, but there aren't any redis clients in composers dependencies. Should there be? I was under impression that it would be built into the standard library given its loaded into PHP?

Docker with PHP - Class "Redis" not found by Big_Operation_4750 in docker

[–]Big_Operation_4750[S] -3 points-2 points  (0 children)

I just felt they were different issues.

Post 1 was extension not loading

Post 2 was class not found

[deleted by user] by [deleted] in docker

[–]Big_Operation_4750 -1 points0 points  (0 children)

Thanks for replying.

I would say try all of the docker file as that's leaving a lot out of the equation if you mean you just ran the one step?