Browse Source

BETA: 2 server optimization configs (thanks nik)
1. Database Cleanup - in most cases this is just slowing up the server start, on a big servers it takes up to 1 min or more to cleanup the database, and in the most cases ending up with 0 elements.

2. Connection Close Time - Higher number fixes the "Unclosed Connection!" errors, caused by the big queries

Rumen Nikiforov 14 years ago
parent
commit
e6dc084e14

+ 4 - 0
L2J_Server_BETA/java/com/l2jserver/Config.java

@@ -441,6 +441,8 @@ public final class Config
 	public static int AUTODESTROY_ITEM_AFTER;
 	public static int HERB_AUTO_DESTROY_TIME;
 	public static TIntArrayList LIST_PROTECTED_ITEMS;
+	public static boolean DATABASE_CLEAN_UP;
+	public static long CONNECTION_CLOSE_TIME;
 	public static int CHAR_STORE_INTERVAL;
 	public static boolean LAZY_ITEMS_UPDATE;
 	public static boolean UPDATE_ITEMS_ON_CHAR_STORE;
@@ -1828,6 +1830,8 @@ public final class Config
 					{
 						LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
 					}
+					DATABASE_CLEAN_UP = Boolean.parseBoolean(General.getProperty("DatabaseCleanUp", "true"));
+					CONNECTION_CLOSE_TIME = Long.parseLong(General.getProperty("ConnectionCloseTime", "60000"));
 					CHAR_STORE_INTERVAL = Integer.parseInt(General.getProperty("CharacterDataStoreInterval", "15"));
 					LAZY_ITEMS_UPDATE = Boolean.parseBoolean(General.getProperty("LazyItemsUpdate", "false"));
 					UPDATE_ITEMS_ON_CHAR_STORE = Boolean.parseBoolean(General.getProperty("UpdateItemsOnCharStore", "false"));

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/L2DatabaseFactory.java

@@ -224,7 +224,7 @@ public class L2DatabaseFactory
 			{
 				con = _source.getConnection();
 				if (Server.serverMode == Server.MODE_GAMESERVER)
-					ThreadPoolManager.getInstance().scheduleGeneral(new ConnectionCloser(con, new RuntimeException()), 60000);
+					ThreadPoolManager.getInstance().scheduleGeneral(new ConnectionCloser(con, new RuntimeException()), Config.CONNECTION_CLOSE_TIME);
 				else
 					getExecutor().schedule(new ConnectionCloser(con, new RuntimeException()), 60, TimeUnit.SECONDS);
 			}

+ 4 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/idfactory/IdFactory.java

@@ -111,7 +111,10 @@ public abstract class IdFactory
 	protected IdFactory()
 	{
 		setAllCharacterOffline();
-		cleanUpDB();
+		
+		if (Config.DATABASE_CLEAN_UP)
+			cleanUpDB();
+		
 		cleanUpTimeStamps();
 	}
 	

+ 13 - 0
L2J_Server_BETA/java/config/General.properties

@@ -261,6 +261,19 @@ AutoDestroyHerbTime = 60
 # Default: 0
 ListOfProtectedItems = 0
 
+# Cleans up the server database on startup.
+# The bigger the database is, the longer it will take to clean up the database(the slower the server will start).
+# Sometimes this ends up with 0 elements cleaned up, and a lot of wasted time on the server startup.
+# If you want a faster server startup, set this to 'false', but its recommended to clean up the database from time to time.
+# Default: True
+DatabaseCleanUp = True
+
+# The time before a database connection closes (in miliseconds)
+# If a query takes longer to execute than the time defined here, the server will throw "Unclosed Connection!" error.
+# If you get often this error message, try increasing this.
+# Default: 60000ms
+ConnectionCloseTime = 60000
+
 # This is the interval (in minutes), that the gameserver will update a players information such as location.
 # The higher you set this number, there will be less character information saving so you will have less accessessing of the database and your hard drive(s).
 # The lower you set this number, there will be more frequent character information saving so you will have more access to the database and your hard drive(s).