App performance reduce with remote mysql server
-
Hey guys, need help asap!
i am developing a school management project that is very large and its multi-user that is database is centric in a remote server.
now main question arise after opening a database..........
1.its take a lot of time for query or fetching data from server that is reduce my qt app performance . so what should i do?
i just use for my connect to db is here is the code snippet...@db= QSqlDatabase::addDatabase("QMYSQL");
db.setHostName(my.host.name");
db.setDatabaseName("TheDatabaseName");
db.setUserName("SomeUser");
db.setPassword("VerySecretPassword");
@
please help me..i am new in qtEdit: Removed real-looking login information and replaced it by something obviously phony; Andre
-
In a first step you should immediately edit out any logon credentials in your post. Now.
If you suffer from performance problems it might be
- the network connection which isn't performant enough,
- the database server which isn't performant enough,
- bad database design,
- suboptimal client code (frequency of updates, structure of SQL statements, ...).
Take a look at the Query Log and the Slow Query Log, obey "MySQL performance basics":http://forge.mysql.com/wiki/Top10SQLPerformanceTips or just provide some actually useful bits of information (database design, application design, queries - whatever) so we might help you further (altough you will be better off at some database-centric forum/mailing list).
But there is one thing I can tell you for sure: Qt is (most probably) not the reason your application is not performing as expected.
-
If you want to exclude your application being the cause of the performance drop (I don't think it actually is the cause) you can simulate each query your application is doing via a remote mysql terminal and get an idea if there is a poor query that is consuming bandwidth or cpu (or both) or disk.
Usually, this is a database design problem. -
Hi guys,
thanks for your response as a new in qt it would be according to your answer.
My client is server based that means data will remain at the central server so that multiuser can access those data using my client.Now...
If i use localhost server it's ok enogh but when i am accessing remote database database for fetching or query then client response much slower than before i used localserver. So what should i do increase the performance... -
Well, then still all those four problems might hit you (most probably you are hit be all). Again - without any implementation details there is nothing we can do for you. In addition, this is not a Qt-related problem so you might be better of at some MySQL/DBMS-centric forum or mailing list.
-
I agree with the posters above that you most likely have a db and/or a network problem, not so much a Qt problem. However, if you remotely access database, you will have to take into account that that is going to be slow sometimes no matter what you do. There are plenty of reasons beyond the control of your application that may cause this.
So, you will need to try to make sure the GUI of your application is at least not affected by your poor database performance. If you can, you can isolate your database transactions in a separate thread, so it does not block your GUI thread. Please note however that a database connection can only live in a single thread, and that this does not work if you use a class like QSqlQueryModel.
-
Thanks for your help i am just getting close to what i need ..specially thanks @Andre
-
Well, your application sounds like any other database based application out there, so the problem is almost in the way you query your data and you manage it. A good starting point is to activate logging on the remote server to see which queries are issued from the application, you could find you are making queries you don't need. As already emphasized in this thread, without more details it is very difficult to know what is going bad, it could be from a simple select * where you need only a field to a non-optimized join to a network problem to a lock issue.....
-
Thanks for your coincidence I agree with @andre i need to use thread because gui is locked when querying data or submitting data to remote server...can any one tell how work well thread with sql please .........