Thanks for the information so far. I recently moved back to Linux on another host for my server and all reports say that loot lag is now gone. I don't know yet if it was due to the better hard drive speeds on the host we are on now, or the difference from Windows to Linux.
Anyway, I did find something just now that could definitely cause a noticeable amount of extra unnecessary work on the server during looting. Basically, in the Corpse::MakeLootRequestPackets(Client* client, const EQApplicationPacket* app) function, it does a client->Save() after it gives out any cash from the corpse. The problem is that client->Save() is a very heavy database query. Within that same function, it also uses the AddMoneyToPP() function to add money to the player profile, which also saves the character with save(). This means it is doing a very heavy query 2 times in a row when it only needs to be doing it once. I think we can just remove the extra client->Save() from the MakeLootRequestPackets() function to make a noticeable improvement on loot performance.
Related to that find, I have another question:
Does anyone notice a difference in looting response times depending on if they have /autosplit turned on or off?As mentioned above, the Save() function causes some pretty heavy work on the server. For anyone with autosplit enabled, it does a Save() for each member of the group when they get money from the split, so for a full group using autosplit, that would cause 7 Saves() (including the 1 extra one it does that isn't needed). I would guess that if you disable autosplit, on your character that is looting, the looting performance would increase considerably. Furthermore, I would guess that Shawo has /autosplit enabled on the older characters that are taking longer to loot than the newer character (which I also guess do NOT have /autosplit enabled). Right now, that is the only explanation I can find that would explain why certain characters would experience loot lag while others do not.
Please let me know what your testing finds. I will keep looking and will probably update the source to remove the extra Save() that is not needed unless Secrets or someone else gets to it first.
*** EDIT ***Well, from looking through the source, I think there are probably a few more places where Save() may be able to be removed to improve performance. For one; in client_packet.cpp in Handle_OP_ShopPlayerSell it also uses AddMoneyToPP() which does Save() as well as another Save(1) at the end of the function. So, if people are experiencing loot lag, they may also see lag while selling to merchants due to the same double Save() reason as looting.
Also, while looking closer at the Save() function, I noticed that SavePetInfo() was added by Leere on the Rev2069 Commit on Nov 26 2011.
http://code.google.com/p/projecteqemu/source/detail?r=2069If you take a look at the SavePetInfo() function, it does quite a few extra DB queries.
http://code.google.com/p/projecteqemu/source/search?q=SavePetInfo&origq=SavePetInfo&btnG=Search+TrunkFor anyone who ran a server a few years ago, they may remember the issue with lag caused by server-wide character Save()s that happened every 60 seconds by default. With all of the Save()s in the code now, a big server could probably suffer from similar performance issues like were seen at that time, but more on a player by player basis I think depending on what they are doing.
I think to really fix this, it might require a few complex changes. The easiest fix to improve performance would probably be to move the SavePetInfo() function out of the Save() function, but then we would need to find the best spots to put it, which would take some research and testing. Leere may know offhand which times are essential to make sure that info is saved. I would guess anytime you zone, when you summon a pet, when a pet dies, when a pet is given items or buffed, and when you log out might be enough, but there could be others.
Next, the best way to improve performance would be to get rid of the damn player profile blob in the database. Then, instead of having to do a whole Save() (which saves a ton of extra crap), we could just have it save money value changes when selling something, or inventory changes, etc all separately as needed. Though, that would require individual functions for each and also all of those functions to be distributed out in the source to the correct functions as needed. I think this could boost overall performance considerably and allow a much higher number of players on a server before lag is seen (assuming the internet connection can handle it).
I do still think that Discovered Items can be written to not cause nearly as many DB hits as it does by just loading Discovered Items into memory so we only need to hit the database if something isn't already loaded into memory as being discovered. But, I don't think it is the cause of the loot lag that has been seen on several servers recently.