Closed assasin541 closed 4 years ago
@jiangdashao I observed tick times and Matrix has impact on it. Please work on it if you can and keep up the good work <3
can't
@jiangdashao why you can't? Async is the best thing that you can do. Sometimes Matrix has around 15% impact on tick times. Maybe just async for phase, interact through walls, movement, velocity?
This means I need to rewrite the move check
@jiangdashao you were very close some time ago to have good async and it will help really, really much.
@jiangdashao you can think about removing ProtocolLib dependency, it will help too. <3
You could maybe replace it with HamsterAPI it’s faster
@Hyronymos1337 switching to another api is pointless.
@assasin541 protocollib is not problem, its the best, re should be using protocollib more, and async movement checks. re is using bukkit events too much such as entitydamagebyentity and playermoveevent instead of checking packets.
@Maximillus there are better ways of handling packets than Plib, but async is must have.
@Maximillus there are better ways of handling packets than Plib, but async is must have.
Better ways? You mean with nms? Enlighten us. What is this "better" way that doesn't make cross version support a headache and offers what plib cant?
Async is not the solution for everything
@SkyLicks @jiangdashao surely knows what to do. @Hyronymos1337 of course, but definetely it's the solution to not impact tick times and keep the gameplay smooth.
@jiangdashao maybe add a method to the api in which you would be able to set own packet listener? If that will be not set you would just use your own.
@jiangdashao what's that? https://share.getcloudapp.com/6queqrOB
@jiangdashao also example profiler, matrix increased tick time by 40%. https://share.getcloudapp.com/E0un0ArR
@jiangdashao also when someone gets hit with for example bow with punch 1000 (or maybe lower) every tick will take around 13-18% more time to process.
@jiangdashao I can't wait to see async, I think it's the highest priotity, from my profilers I see that only Matrix has impact on tick times, with only few players you see tick times increased by 20-30%, which is huge lag. If you make async you can think about removing ProtocolLib dependency. Good work!
@assasin541 First of all, RE will most likely NOT remove the ProtocolLib dependency, PLib is the best Packet Listener API out there and for an Anti cheat it is absolutely essential.
You claim that Async can fix everything because.. well.. its Async right?? Wrong. RE Uses the Bukkit move event in order to check for speed and all that since by using the bukkit api he's able to get the nearby entities, and so on.
Therefore, The bukkit api should NOT be accessed from a different thread, Do u remember what happened when RE implemented the Async movement checks?
Server Crashes Constant Errors In rare cases, The server would get damaged
To add on top of that, I'm pretty positive RE could listen to the flying packet using PLib and make some checks or speed modules work by using packets (Yes asynchronously). But in all honesty, If RE claims that he Can't. It's not that he doesnt want to, It's because he doesn't wanna mess up your server.
or alternatively, He could make the checks themselves a tiny bit lightweight.
@NikV2 @jiangdashao 27% of tick times is huge. https://share.getcloudapp.com/X6uNppve Deleting Plib will increase performance, maybe it's the "most mature packet monitoring library", but sendind and listening packets on your own is easier than you think and you will achieve better performance. I remember async with Matrix, there was no problmems, until RE tried creating own threads, all threads had 100% of cpu usage and it was like that all the time. Of course you have to call some apis in the main thread, but some can be called async and you can just call some methods in sync, but managin movement, velocity etc. in sync is just killing the servers' main thread. I have almost everything in async and just world methods or something are taking 5%, and Matrix are taking 27%. It makes every couple tick last 13-35% longer, which creates lag spikes.
@assasin541 If you are experiencing such lag with Matrix anticheat it's time to upgrade your server hardware.
AMDBartek update what? Matrix causes these lag spikes.
Upgrading your server hardware should fix lag spikes or maybe take a look at some server optimisation guides: https://www.spigotmc.org/threads/guide-server-optimization%E2%9A%A1.283181/
@AMDBartek what server hardware? You see in the profiler that Matrix is causing lag spikes.
Yes, but if you have powerful hardware the lag spikes wouldn't happen in the first place.
AMDBartek I have very powerful hardware, but Minecraft's main thread is the thing that is scary and in this thread things like anticheat checks shouldn't be running.
Ok, would you mind showing me your checks.yml file?
Also, try a server with just Matrix and ProtocolLib to see if the issue persists.
@AMDBartek nothing special is in it, changing skip_rate to 3 isn't helpful too and you can't change much there. Profiler clearly shows that it's Matrix's fault.
Oh well, I am not sure then.
@AMDBartek let's see how it will work with async Matrix.
It's very strange you're getting such big perfomance issues caused by Matrix especially in 1.8. I'm running Matrix with average hardware in 1.15.2 just fine, And 1.8 is known to be one of the most stable versions.
Mind sharing your server's specs? CPU-Ram and such
@NikV2 how many online players do you have on a single server? Bukkit servers are running on machine with 2x Xeon E5-2630v3 and 128GB ram. Profilers clearly show that Matrix has really big impact on main thread. Without Matrix it would be max 5%, with it's around 30%.
Not many, Damn 128GB Ram. That's NASA Level ram right there:")
Well it's true that movement checks are the heaviest ones in Matrix. And i agree that Modules like NoFall - Velocity should be checked by using Packets (PLib). Although, the suggestion to remove protocollib really wouldn't make a difference regarding the Movement checks.
This thread has been closed by RE, So for the time being i'd suggest waiting to see if RE's able to do it in a future update
@NikV2 the main problem is lagging main thread. If this problem will be solved we should think about other improvements.
@jiangdashao any progress with async? I can't wait to see it, because it has big impact on tick times. <3
There will be no async in the short term, because it is a huge job
I agree motion checks take a lot of performance on Matrix. I myself have this issue on my server (which by the way has great hardware). NGL, in the long term, improving motion checks is a worth it investment.
However, meanwhile, I suggest you do what I did: Using the Matrix tempbypass api, I give players unlikely to cheat (e.g. players who have been online for x amount of time with out suspicious behavior) bypass perms on movement checks. Or maybe the people at spawn bypass perms as they are less likely to cheat. As a result, I target only players most likely to cheat with Matrix. Utilizing this will require a dev though.
@jiangdashao you had async before, now when everything is sync almost every tick takes 5-30% more time to process. When people fight all the time you can really see this impact. I think it's easier to do, but if it takes couple days or 1/2 weeks this will be perfect and well done job. @SkyLicks if you work in the main thread it's really easy to get lack of smoothness or getting lags. I develop plugins by myself so I could use your technique, but that's just temporary workaround. The main difference will be async checks. You can do everything in async, edit your server's jar, but if matrix is in sync there will be lag...
@jiangdashao today I had a dream that you added async to Matrix... please bring it back, keep up the good work! <3
Wtf is wrong with you
@Antideveloppeur what do you mean? Matrix just strongly impacts my server and it irritates me that I can't do anything about it.
@jiangdashao Matrix showed today 50% usage on profilers. I was checking all ticks, so it's really bad, bad performance. There were only 60 players on a single server, please bring back async.
Re is aware of this and has already agreed to on using Async to imprpve performance. https://github.com/jiangdashao/Matrix-Issues/issues/1967
@SkyLicks yes, but my issue is more detailed and I suggest to remove ProtocolLib dependency. Everything you do under a PLib will have pretty low performance and I have to use Plib only to use Matrix.
Every professional Anti Cheat uses ProtocolLib.
Packet checks are way better perfomance-wise. I really can't see how ProtocolLib itself could be massively reducing your server's perfomance
@NikV2 you can create AntiCheat without ProtocolLib to have better performance. You can listen/send packets very easily without any library. I have my own AntiCheat without Plib.
What features/checks do you need?: Async would be very good, I see that without it Matrix has impact on performance also without protocollib it would be very efficient. Maybe just add async for phase and movement like it was some time ago? Removing ProtocolLib dependendy will be good idea too, for my plugins it wasn't that hard.