Jump to content

Recommended Posts

Posted

What would be the reason of pause the tread of player for like 1.5 to 2 seconds upon sendSkillList? 

I did berchmark on the

public void sendSkillList(final L2PcInstance player)

code it return literally 0.06 millisecond respond time So thats no the reason. There is no other code

both admin (give_all_skills) and the sub-class use the sendSkillList(player);  which it really has no delay since i made it's List and it's really fast.

What else would cause this 1.5 - 2 second delay upon give skill list?  Give some advice

Posted (edited)
21 minutes ago, .Elfocrash said:

It's client side. The server is bombarding the client with one packet per skill and it essentially gets flooded.

Wait wait.. the skillList is a packet that contains a sub-list so basically  on a List you load all getPlayerAvailableSkills 

and u add them on SkillList packet and then at the end u send 1 time the packet.  so ?  It's not about fix. 1.5 sec delay is no problem is just

it make me so fucking curious.. i did berchmarks and is so fast that even in nanoseconds it show 3500 to complete all giveSkillListToPlayer(); 

Edited by Ο Χάρος
Posted (edited)

The method to retrieve skills is probably not optimized. The same effect happens on subclass acquisition, where you can wait a solid 3 to 5 seconds, only because the method doesn't filter correctly things, and reward you will all possible skills (and reward skills means one database query per skill acquisition, because there is no global method to reward all skills), while you should filter first and reward after.

sendSkillList is probably ok and got no specific reason to bug by itself (there was a slight edit to do for a specific case, but otherwise nothing to do).

Before holidays on Croatia, I was actually reworking the whole thing on aCis.

 

You should add more details about which methods you are invoking, what you try to do, etc.

Edited by Tryskell
Posted (edited)
19 minutes ago, Tryskell said:

The method to retrieve skills is probably not optimized. The same effect happens on subclass acquisition, where you can wait a solid 3 to 5 seconds, only because the method doesn't filter correctly things, and reward you will all possible skills (and reward skills means one database query per skill acquisition, because there is no global method to reward all skills), while you should filter first and reward after.

sendSkillList is probably ok and got no specific reason to bug by itself (there was a slight edit to do for a specific case, but otherwise nothing to do).

Before holidays on Croatia, I was actually reworking the whole thing on aCis.

 

You should add more details about which methods you are invoking, what you try to do, etc.

EDIT

sendSkillList() is packing the skills together but the restoreSkills() method is locking the shit out of the thread because of the sql involved.

Edited by .Elfocrash
Posted

Let me get the things straight:

This is the admin method that give ALl skills to players.  and the method that does that is the sendSkillList ( same called in sub-class)


	private void adminGiveAllSkills(final L2PcInstance activeChar, final boolean includedByFs)
	{
		final L2Object target = activeChar.getTarget();
		L2PcInstance player = null;
		if (target instanceof L2PcInstance)
		{
			player = (L2PcInstance) target;
		}
		else
		{
			activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.INCORRECT_TARGET));
			return;
		}
		player.sendSkillList();
	}

 

Now in this method as u can see: 

public void sendSkillList(final L2PcInstance player)
	{
		boolean isDisabled = false;
		final SkillList sl = new SkillList();
		
		if (player != null)
		{
			for (final L2Skill s : player.getAllSkills())
			{
				if (s == null)
				{
					continue;
				}
				if (s.getId() > 9000 && s.getId() < 9007)
				{
					continue;
				}
				if (_transformation != null && !containsAllowedTransformSkill(s.getId()) && !s.allowOnTransform())
				{
					continue;
				}
				if (player.getClan() != null)
				{
					isDisabled = s.isClanSkill() && player.getClan().getReputationScore() < 0;
				}
				boolean isEnchantable = SkillTable.getInstance().isEnchantable(s.getId());
				if (isEnchantable)
				{
					final L2EnchantSkillLearn esl = EnchantGroupsTable.getInstance().getSkillEnchantmentBySkillId(s.getId());
					if (esl != null)
					{
						if (s.getLevel() < esl.getBaseLevel())
						{
							isEnchantable = false;
						}
					}
					else
					{
						isEnchantable = false;
					}
				}
				if (getAioEndTime() > System.currentTimeMillis() && !isGM() && !isInsideZone(ZONE_TOWN))
				{
					isDisabled = true;
				}
				sl.addSkill(s.getId(), s.getLevel(), s.isPassive(), isDisabled, isEnchantable);
			}
		}
		
		sendPacket(sl);
	}

 

All skills are gathered into a packet that is send only 1 time upon the end of code. This class takes 3500 nanoseconds to be done, aka 0 milliseconds

 

The only method that retrieve the skills here is just this:

 

public final L2Skill[] getAllSkills()
    {
        if (_skills == null)
        {
            return new L2Skill[0];
        }
        return _skills.values().toArray(new L2Skill[_skills.values().size()]);
    }

Basically a Map that is turned into array (no delay at all obviously). 

 

I did in both methods 

long ms = System.getNanoTime(); 

System.out.println(System.getNanoTime() - ms); and it show all 0 MS in total.  MAX 1 ms. So the reason of 2 sec delay is not justified

Posted
6 minutes ago, .Elfocrash said:

He said the code returns the skills in milliseconds but the client lags. If the method returns data instantly then it is clearly the client.

If it wasn't then every player would lag not just the one.

 

I did compare to H5 branch (cause i use freya) and the code is the same (just in H5 they added 1 more check for add the skill on holders) nothing to do with retreive or store. 

But in H5 it really takes 0.2 sec delay to give 45 skills while in freya it take 1.5 sec delay. I can imagine with extra skills it could take 3 sec delay.

Posted
1 minute ago, Ο Χάρος said:

 

I did compare to H5 branch (cause i use freya) and the code is the same (just in H5 they added 1 more check for add the skill on holders) nothing to do with retreive or store. 

But in H5 it really takes 0.2 sec delay to give 45 skills while in freya it take 1.5 sec delay. I can imagine with extra skills it could take 3 sec delay.

It might come down to the packet length which they might have improved in H5.

Posted
Just now, .Elfocrash said:

It might come down to the packet length which they might have improved in H5.

 

oh, true didn't think of that.  If i do   packet.toString().lenght();  this would return the packet size (somehow) i could compare to H5 then ?

Posted
Just now, .Elfocrash said:

Nah the size should be roughly the same. It is the client code that might process it differently in H5

So basically you say that the size wouldnt change maybe the method that handle the packet is wrong. i check the H5 method SKilLIst and is this https://pastebin.com/AXws0Pgb

while on freya ishttps://pastebin.com/3HzmwR49

So basically on Freya the constructor create a new FastList which is slow as fuck compare to arrayList so ill go ahead and change this cause javolution is slower by 30% as i saw

I'll try my lack with this and report back. 

Posted
Just now, .Elfocrash said:

There is no way that this is the problem.

Another obvious pointer would be that H5 is using HikariCP as the default db connection pool while Freya is still c3p0 which is like a million times slower (if somehow db is getting involved).

Now im thinking it's stupid cause the method was including in berchmark so any sub-calculations wouldnt again be recorded on system out at sendSkillList.. again i tested it nothing changed.. 

You're right..  No there is no DB connection involved.. I double check the code.

 

It goes from this: 

/**
	 * This function will give all the skills that the target can learn at his/her level
	 * @param activeChar: the gm char
	 */
	private void adminGiveAllSkills(final L2PcInstance activeChar, final boolean includedByFs)
	{
		final L2Object target = activeChar.getTarget();
		L2PcInstance player = null;
		if (target instanceof L2PcInstance)
		{
			player = (L2PcInstance) target;
		}
		else
		{
			activeChar.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.INCORRECT_TARGET));
			return;
		}
		//Notify player and admin
		activeChar.sendMessage("You gave " + player.giveAvailableSkills(includedByFs, true) + " skills to " + player.getName());
		player.sendSkillList();
	}

To this 

 

public void sendSkillList()
	{
		sendSkillList(this);
	}

 

To this 

 

public void sendSkillList(final L2PcInstance player)
	{
		boolean isDisabled = false;
		final SkillList sl = new SkillList();
		
		if (player != null)
		{
			for (final L2Skill s : player.getAllSkills())
			{
				if (s == null)
				{
					continue;
				}
				if (s.getId() > 9000 && s.getId() < 9007)
				{
					continue;
				}
				if (_transformation != null && !containsAllowedTransformSkill(s.getId()) && !s.allowOnTransform())
				{
					continue;
				}
				if (player.getClan() != null)
				{
					isDisabled = s.isClanSkill() && player.getClan().getReputationScore() < 0;
				}
				boolean isEnchantable = SkillTable.getInstance().isEnchantable(s.getId());
				if (isEnchantable)
				{
					final L2EnchantSkillLearn esl = EnchantGroupsTable.getInstance().getSkillEnchantmentBySkillId(s.getId());
					if (esl != null)
					{
						if (s.getLevel() < esl.getBaseLevel())
						{
							isEnchantable = false;
						}
					}
					else
					{
						isEnchantable = false;
					}
				}
				if (getAioEndTime() > System.currentTimeMillis() && !isGM() && !isInsideZone(ZONE_TOWN))
				{
					isDisabled = true;
				}
				sl.addSkill(s.getId(), s.getLevel(), s.isPassive(), isDisabled, isEnchantable);
			}
		}
		
		sendPacket(sl);
	}

 

And stops. I use the admin command admin_give_all_skills  So is not SQL relative. Even if it was i have fast disk it wouldnt downgrade so much.

 

Posted
Just now, .Elfocrash said:

Whats in 


player.getAllSkills()

public final L2Skill[] getAllSkills()
    {
        if (_skills == null)
        {
            return new L2Skill[0];
        }
        return _skills.values().toArray(new L2Skill[_skills.values().size()]);
    }

Map to array 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Posts

    • @Mobius I only asked you one question! All your previous versions are sh*t and the last version is the best ? Because this is what you said.
    • Close that LOLserver. And change name to L2Wipe&Money.
    • Open Beta January 17th & 21:00 UTC +2 Launch Date January 24th & 21:00 UTC +2 Click Here to Explore Vanilla Gracia Final Low-Rate Server. Join our Discord Community     Following the success of our Vanilla project, we decided to launch it again as Last PlayINERA’s Server! Core Settings *Vanilla will have Strict Botting & Client Limitation Rules and Chronicle Progression from Gracia Final to Gracia Epilogue to H5 in Long term! XP: x4 SP: x4 Adena: x2 Drop: x2 Spoil: x3 Manor: x0.4 (60% reduction) - Festive sweeper enabled! Seal Stones: x2 Herbs: x1 Safe Enchant: +3 Maximum Enchant: Retail Enchant Rate: Dynamic General Settings Auto-loot Can be toggled Buffs Adventurer Guide buffs are free, retail level limit removed. Buff Slots: 20 (+ 4) Summon buffs will remain on re-summoning & on death while Noblesse blessing is applied! (Olympiad excluded) Pet buffs will be saved on relog but not during summon/unsummon. Event Buffer [NEW] Event Buffer is enabled and will spawn randomly between 18:00 ~ 23:00 in Giran for 10 minutes, it will apply Farm Only buffs that are cancelled in PvP, Siege / Epic PvP zones & while in a chaotic state! Duration: 1-hour! Territory Wars every two weeks on Saturday. Castle sieges every two weeks on Sunday Class Transfer 1st Class Transfer: Available for purchase with either Adena or iCoin 2nd Class Transfer: Available for purchase with either Adena or iCoin 3rd Class Transfer: Quest or iCoin (the 3rd class transfer will become available for purchase with iCoin as soon as someone has entered the Hall of Fame for completing the 3rd class transfer quest for the class in question) Hellbound Hellbound Lv. 0-6: ATOD x1 Hellbound Lv. 7-12: ATOD x2 Tiat & Ekimus will become available at Stage 12 Hellbound can only be leveled up by killing monsters. No quests or raids are needed To open Hellbound, a party must kill Baylor in the Crystal Caverns The following items are now tradable: Ancient Tome of the Demon  Hidden First Page  Hidden Second Page  Demon Contract Fragment INERA Hub Library Clan Recruitment System Options Services Milestone Rewards Earn rewards for reaching various daily/one-time goals Client Limit: 1 (+1 with Standard Premium) Shift + Click Information on Monsters SP are required to learn new skills Offline shops Lasts for 15 days Olympiad Olympiad period: 1st and 15th day of the month (14th & Last day of month is the last day) 3 Vs. 3 match disabled Class-based matches will be held over the weekends One registration per HWID (PC) Minimum participants: 9 Party Matching System Earn bonuses for finding a group via the Party Matching system Vote Reward System World Chat No limits for first day! Available from level 20 Raid Bosses Epic Raid Boss zones will turn into a PvP zone while the Epic Raid Boss is alive ( + means Random) Server will start with all grand raids dead. Normal Raids: 12h (+6 hours random). Subclass raids, respawn 12h (+6 hours random). Noblesse Barakiel 12h (+6 hours random, PvP zone). Anakim & Lilith are static 24 hours respawn. Queen Ant: 24 hours (+2 hours random). Core: 40 hours (+2 hours random). Orfen: 32 hours (+2 hours random). Antharas Respawn: 8 Days. Randomly spawns at 19:00 ~ 21:00 Boosted to level 83 on Hellbound stage 7. Valakas Respawn: 10 Days. Randomly spawns at 19:00 ~ 21:00 Baium Respawn: 5 Days. Randomly spawns at 21:00 ~ 23:00 Boosted to level 83 on Hellbound stage 7. Frintezza Respawn: 2 Days. Randomly spawns at 21:00 ~ 23:00 Instanced Zaken Zaken (Day): Monday, Wednesday, Friday at 6:30. Zaken (Day): 9 players, LvL 55-65, 1hr max. Zaken (Night): Wednesday at 6:30 Zaken (Night): 18-45 players, LvL 55-65, 6hr max. Tiat: Saturday at 6:30, 18-36 players, 2 hrs max. Boosted to level 85. Ekimus: 24h at 6:30, 18-27 players, 1hr max. Tully’s Workshop (Darion & Tully): 24h +-1h. Tower of Naia (Beleth): 5 days, 18 min. & 36 max.
  • Topics

×
×
  • Create New...