My python app uses CursorNW for most queries using 1.0 MySQLdb. We recently upgraded to mysql4.1 to get the clustering, and thus broke our app. I switched to using the normal Cursor, but now the program just makes hundreds of mysql processes and eventually brings the server load to around 3.5 and becomes unusable.
Do I need to manually close connections or something? And how to I get the normal Cursor to behave like the old CursorNW?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So using 1.1.7 and having changed my code to use Cursor (instead of CursorNW) I am now getting tons of mysql processes. They never seem to close? Are there other changes I need to make? It's making my machine unusable.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well, you should close your connections, yes, or at least close your cursors when you are done with them. There's another recent thread about Apache with threads where I have some tips on using the Pool module to have persistent connections; that may help the performance of your application.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Use MySQLdb-1.1.7. There is no longer a CursorNW class, but the standard cursor does not raise the Warning exception. Instead it uses the Python warnings module, which can do filtering.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My python app uses CursorNW for most queries using 1.0 MySQLdb. We recently upgraded to mysql4.1 to get the clustering, and thus broke our app. I switched to using the normal Cursor, but now the program just makes hundreds of mysql processes and eventually brings the server load to around 3.5 and becomes unusable.
Do I need to manually close connections or something? And how to I get the normal Cursor to behave like the old CursorNW?
Thanks for the rapid response!
So using 1.1.7 and having changed my code to use Cursor (instead of CursorNW) I am now getting tons of mysql processes. They never seem to close? Are there other changes I need to make? It's making my machine unusable.
Well, you should close your connections, yes, or at least close your cursors when you are done with them. There's another recent thread about Apache with threads where I have some tips on using the Pool module to have persistent connections; that may help the performance of your application.
Sorry, I forgot to mention these problems started apearing after the upgrade to 1.1.7.
Use MySQLdb-1.1.7. There is no longer a CursorNW class, but the standard cursor does not raise the Warning exception. Instead it uses the Python warnings module, which can do filtering.