|
You last visited: Today at 04:55
Advertisement
Any comments/ideas for a better performance
Discussion on Any comments/ideas for a better performance within the CO2 Private Server forum part of the Conquer Online 2 category.
08/05/2011, 19:37
|
#1
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
Any comments/ideas for a better performance
I decided that this forum doesn't deserve or appreciate my work and I am not going to support it by releasing/maintaining my work and generating traffic for it.
|
|
|
08/05/2011, 21:04
|
#2
|
elite*gold: 0
Join Date: May 2010
Posts: 248
Received Thanks: 36
|
its near to impluse one but i think its good
|
|
|
08/05/2011, 21:50
|
#3
|
elite*gold: 0
Join Date: May 2011
Posts: 1,769
Received Thanks: 756
|
You got these:
Code:
public Update Set(string column, object value)
{
UpdateString += column + "='" + value + "', ";
return this;
}
public Update Where(string column, object value)
{
UpdateString = UpdateString.Remove(UpdateString.Length - 2, 2);
UpdateString += " WHERE " + column + "='" + value + "'";
return this;
}
Where you could just do:
Code:
public void Set(string column, object value)
{
UpdateString += column + "='" + value + "', ";
}
public void Where(string column, object value)
{
UpdateString = UpdateString.Remove(UpdateString.Length - 2, 2);
UpdateString += " WHERE " + column + "='" + value + "'";
}
Why?
Because there is no point returning something, that is already there.
|
|
|
08/05/2011, 22:53
|
#4
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
Quote:
Originally Posted by BaussHacker
You got these:
Where you could just do:
Why?
Because there is no point returning something, that is already there.
|
im aware of that but with out the return; any update command it'll look something like .
PHP Code:
//with return; will look like
SQL.Engine.Update("Table")
.Set("column", "value")
.Where("column", "value")
.Execute();
//with out the return;
SQL.Engine.Update("Table").Set("column", "value");
SQL.Engine.Update("Table").Where("column", "value");
SQL.Engine.Update("Table").Execute();
//and each time you do
SQL.Engine.Update("Table").etc
//a new update command well be created .
so i think the way it was makes more sense and it looks better too :P
its meant to be easier though , and the performance is the same in both cases .
|
|
|
08/06/2011, 12:14
|
#5
|
elite*gold: 20
Join Date: Mar 2006
Posts: 6,126
Received Thanks: 2,518
|
Stored procedures, cached lookup, settings on the sql server etc.
|
|
|
08/06/2011, 14:27
|
#6
|
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
|
Quote:
Originally Posted by Korvacs
Stored procedures, cached lookup, settings on the sql server etc.
|
A good pooling system (already done by the mysql dev team) beside what Korvacs said and your mysql will rock. Don't limit yourself to one connection which may fail. All you have to do is study a bit about mysql's connection bug and connection string.
|
|
|
08/06/2011, 21:06
|
#7
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
Quote:
Originally Posted by Korvacs
Stored procedures, cached lookup, settings on the sql server etc.
|
i am on it .
Quote:
Originally Posted by -impulse-
A good pooling system (already done by the mysql dev team) beside what Korvacs said and your mysql will rock. Don't limit yourself to one connection which may fail. All you have to do is study a bit about mysql's connection bug and connection string.
|
thanks impulse
but guys for a co Pserver should i keep the connection opened or close it once its done executing ?
|
|
|
08/06/2011, 22:02
|
#8
|
elite*gold: 28
Join Date: Jun 2010
Posts: 2,225
Received Thanks: 868
|
Have a few connections should one die, pull another, add a new connection.
Code:
if (connected.Died)
{
connected = GetNewConnectionFromSomewhere
AddConnection to somewhere.
}
|
|
|
08/06/2011, 22:07
|
#9
|
elite*gold: 0
Join Date: Oct 2009
Posts: 768
Received Thanks: 550
|
Ok, in case you didn't read this post, read it 
^ last paragraph (the EDIT).
As long as you don't set the connection property 'pooling=false' you should dispose of your sql objects. Example:
Code:
using(MySqlConnection conn = new MySqlConnection(...)) {
conn.Open();
using(MySqlCommand cmd = new MySqlCommand(QUERY, conn))
{
cmd.ExecuteNonQuery();
}
}
|
|
|
08/07/2011, 02:33
|
#10
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
Quote:
Originally Posted by _DreadNought_
Have a few connections should one die, pull another, add a new connection.
|
PHP Code:
public class Engine { private static MySqlConnection connection; private static EventHandler ConnectionWatcher = new EventHandler(RestartConnection); public Engine(MySqlConnection Connection) { connection = Connection; connection.Disposed += ConnectionWatcher; } private static void RestartConnection(Object sender, EventArgs e) { try { connection.Open(); connection.Disposed += ConnectionWatcher; //Console.WriteLine(" ConnectionState: Connection has been closed but it's been reconnected Successfully"); } catch { } } }
done  the eventhandler takes care of the connection each time its disposed/closed by reconnecting it Immediately (takes up to 10 millisec's as max and then its connected )
Quote:
Originally Posted by -impulse-
Ok, in case you didn't read this post, read it 
^ last paragraph (the EDIT).
As long as you don't set the connection property 'pooling=false' you should dispose of your sql objects. Example:
|
PHP Code:
public void Execute() { try { Query = "UPDATE " + table + " SET " + UpdateString; OpenConnection(connection);// to make sure that the connection is opened using (MySqlCommand cmd = new MySqlCommand(Query, connection)) { cmd.ExecuteNonQuery(); } } catch (Exception X) { Console.WriteLine(X.Message); } }
private void OpenConnection() { try { connection.Open(); } catch {/*no need to catch any Exception as the Exception messag would be (already connected )*/ } }
that should try to open the connection but it may fail to open it as it may be already connected . the catch (will never throw an exception ) so it executes the query and dispose/clean everything .
but the question is . in failure cases say an exception was thrown .. what should i do with (the query to execute) so its not lost ?
|
|
|
08/07/2011, 13:01
|
#11
|
elite*gold: 28
Join Date: Jun 2010
Posts: 2,225
Received Thanks: 868
|
10 milli sec's max? Oh dear, that doesnt sound good. If I was using mysql i'd be unhappy with that, mmm 5 max? Try have the connection param's already done. Maybe you could connect it and if they support a pause? Connect it, pause it, resume(which should really take a few ms) it and use it. But then again, im not a fanboy with mysql.
as for your question, Thats just it, personally if I was being tied up and slapped by a **** and had to use MySQL id have a list of waiting to execute querys. But that's why mysql isnt good, check out binary(hybrids SAFE binary class) or ini. They're both very good and binary is by FAAAR better then mysql. but if you like the style then mssql is always there.
|
|
|
08/07/2011, 20:13
|
#12
|
elite*gold: 0
Join Date: Aug 2010
Posts: 992
Received Thanks: 1,110
|
Quote:
Originally Posted by _DreadNought_
10 milli sec's max? Oh dear, that doesnt sound good. If I was using mysql i'd be unhappy with that, mmm 5 max? Try have the connection param's already done. Maybe you could connect it and if they support a pause? Connect it, pause it, resume(which should really take a few ms) it and use it. But then again, im not a fanboy with mysql.
as for your question, Thats just it, personally if I was being tied up and slapped by a dick and had to use MySQL id have a list of waiting to execute querys. But that's why mysql isnt good, check out binary(hybrids SAFE binary class) or ini. They're both very good and binary is by FAAAR better then mysql. but if you like the style then mssql is always there.
|
5 as max? well i guess its not my choice to make you have seen how the connection is being done and its being done the right way and when i said as max its been like (3 to 7 ms) but i have seen 10's .
Quote:
public SqlEngine(string Host, string DataBase, string UserName, string Password)
{
string ConString = "SERVER=" + Host + ";" + "Persist Security Info=yes; Max Pool Size=25; Min Pool Size=5;" + "DATABASE=" + DataBase + ";" + "UID=" + UserName + ";" + "PASSWORD=" + Password + ";";
connection = new MySqlConnection(ConString);
}
|
just in case you dident see the ( connection = new MySqlConnection(ConString); ) part . im not creating a new connection with new passed param's every time i reconnect it . all it takes is (connection.open()
Quote:
Connection pooling works by keeping the native connection to the server live when the client disposes of a MySqlConnection. Subsequently, if a new MySqlConnection object is opened, it will be created from the connection pool, rather than creating a new native connection. This improves performance.
To work as designed, it is best to let the connection pooling system manage all connections. You should not create a globally accessible instance of MySqlConnection and then manually open and close it. This interferes with the way the pooling works and can lead to unpredictable results or even exceptions.
|
so basically there is nothing wrong with the way its reconnecting .
and yes you are being tied up and slapped by a dick cus of 2 reasons .
1. a list ? list!! you gotta be kidding me
2. if hybrids said that the sky is green it doesent mean that it is green (it means that he was drunk)
etc
well facebook is having some hard times with mysql but its just due to the site massive data volume but...
they all uses mysql to store there data and mysql is not a bad choice for a privet server we just need to know how to use it .
|
|
|
 |
Similar Threads
|
Best performance of rf
04/16/2010 - RF Online - 1 Replies
Can anyone give me some decent pc specs for smooth gameplay for rf?
|
[Performance-Camtasia Studio]Wie verbessere ich die Performance?
11/13/2009 - Video Art - 4 Replies
Hallo liebe Community und Mitglieder.
Wenn ich mit dem Aufnahmeprogramm „Camtasia Studio" ein Fenster aufnehme, z.B. das Client Fenster von Metin2, verschlechtert sich die Performance beim späteren angucken des Resultates.
D.h. es bleibt bei mehreren Hängern und es ist kein flüssiger Film.
Was habe ich versucht?
#Die Frames pro Sekunde zu erhöhen(bis 200 Frames pro Sekunde, aber dann gibt es auch schon bei der Aufnahme Hänger, bzw. beim produzieren)
#Das Video in der Bearbeitung zu...
|
[Ideas?] Need Some Ideas For My Public Source
09/23/2008 - CO2 Private Server - 11 Replies
hey i need some ideas for the source that im coding (lotf) and when it is done i go public it, so someone got some great ideas? (Serious answers only please:p)
Examples:
Quests
Events
NPCs
|
Comments pls =P
02/07/2008 - Off Topic - 2 Replies
wie findet ihr denn so meine erste signatur? ^^
http://img292.imageshack.us/img292/3032/32579699j a4.png
bitte gibt paar comments ab was man alles aendern
koennte =P
|
Performance
10/23/2007 - World of Warcraft - 4 Replies
Sers leutz,
dezente Frage: wie mehr FPS / Performance in WoW?!
Habe meist nur ~20FPS was ziemlich absuckt..
Zum PC:
AMD Athlon 64 3200+
1024 DDR1 (:-/) Ram
Geforce FX 5900ZT
|
All times are GMT +1. The time now is 04:56.
|
|