Re: Writing multi-threaded mysql application
I'm not sure if there are formal resources on this topic, but here are some basic guidelines I have followed in the past: 1) You can imagine that each running thread will have its own MySQL connection. 2) The connection can get created and held for the lifetime of a thread, or, if you plan to have threads created/destroyed repeatedly, then the connection can come from a connection pool. 3) Make sure that MySQL is configured to handle the number of simultaneous open connections you are planning to create. If you are just trying to write an app that has multiple threads accessing MySQL (versus trying to use/learn C++), you may want to consider using Java and the Connector/J JDBC driver. The Jakarta DBCP project gets you no-hassle connection pooling. And if Posix threads are important, the latest 1.4.2 JVM can use the Native Posix Thread Library (NPTL) found on RH9.0. -Loren --- Ganbold [EMAIL PROTECTED] wrote: Hi, I'm new to multi-threaded programming and reading the book Programming with POSIX Threads and trying to understand concepts and coding. What I'm trying to do is to rewrite mysql client application (which calculates ISP dial-up customers' billing) into multi-threaded version. I'm looking for some resources on multi-threaded mysql application programming and it will be great if somebody knows some tutorials, samples and howto documentations on the web. I searched the web and didn't find anything related to mysql multi-threaded programming. I tried to look at mysql.cc code but didn't find any mysql_thread_init() calls in the source. thanks in advance, Ganbold -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Queries hang on concurrent inserts/locks to the same table
Mike, what version of MySQL are you running? A month ago or so, I tried 4.1alpha on a FreeBSD4.8 machine and noticed the same thing you are describing. I had a bunch of threads inserting on a MyISAM table and the threads would just wedge. They'd show up in SHOW PROCESSLIST and wouldn't respond to being killed. MySQL had to be restarted to free them up. 4.0.13 doesn't exhibit this behavior. --- Mike Lucente [EMAIL PROTECTED] wrote: I use mytop. The only thing that I see is x insert queries all trying to insert to the same table. Killing the oldest query doesn't help, in fact killing any or all of them doesn't do any good either (they just appear to get marked as killed). Note that the table that they're waiting for is a MyISAM table. These should be atomic processes. Is there something at the OS-level that might tell me what's causing the hangup? Did I jump onto the RH9 bandwagon too soon? On Fri, 4 Jul 2003, Jeremy Zawodny wrote: On Thu, Jul 03, 2003 at 06:51:28PM +, Mike Lucente wrote: Hello, I have nine process that import data to tables with the same structure within about 1000 databases on a server. Each process fires at the same time, every 5 minutes. Lately I'm seeing these inserts hang, all waiting upon the same table, and they do not clear up. I've searched through the docs and googled through the lists and can't seem to find anything that would help me to solve this one. I've changed to single-threading the processes for now but would like to revert back to the original method. Note that I had originally wrapped the inserts with LOCK/UNLOCK but this was hanging more often (on the LOCK query). Does anyone know where I might begin? Is there something that I can query to find out what the inserts are waiting for? Have a look at the output of SHOW PROCESSLIST or use a tool like mytop to see what's going on. You can usually get a good idea of what's wating on on what by doing so. Jeremy -- Mike Lucente [EMAIL PROTECTED] 561.218.5527 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] __ Do you Yahoo!? SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: alter table blocks other tables!
I would assume that if you have two MySQL threads, one doing the ugly ALTER TABLE and another responsible for a simple SELECT query (perhaps even query cached) on a table in another database, that no matter how long that ALTER TABLE thread took, the OS would schedule the SELECT thread soon enough and you'd still get timely results. Just curious, are you using FreeBSD? --- Dan Edwards [EMAIL PROTECTED] wrote: I have a mysql server containing multiple databases, one of the databases is very important that it is not slowed down by other databases. This database is used for a real time game server (card games), and any stalls causes all players to stall, they hate that. I've mostly solved this problem with a master/slave setup. The problem now is the other databases in the same mysql instance are getting larg. When I make changes to them with alter table, it can slow down and even block queries to the other databases for minutes at a time. My question is how do I prevent alter table in one database from blocking queries in another database? What I need is some way to say that any queries to this database (or specific tables) have top priority, always. Thanks for any assistance! Dan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
mysql4 query cache pruning unnecessarily?
Hi- Can anyone tell me why mysql4 would prune queries from the cache if the Qcache_free_memory is still very big? I'm confused why we get so many Qcache_lowmem_prunes: | Qcache_queries_in_cache | 175011 | | Qcache_inserts | 343244 | | Qcache_hits | 4041221| | Qcache_lowmem_prunes | 168185 | | Qcache_not_cached| 131| | Qcache_free_memory | 86589360 | | Qcache_free_blocks | 26468 | | Qcache_total_blocks | 376504 | I am on 4.0.13 w/LinuxThreads on FreeBSD4.8-STABLE. __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: mysql4 query cache pruning unnecessarily?
The tables certainly get updated and therefore those queries should be ejected from the cache, but it's not a memory issue. Does that mean that Qcache_lowmem_prunes is actually the sum of low memory prunes and dirty queries? The manual doesn't seem to suggest this, so it would be cool if someone could clear it up for sure. http://www.mysql.com/doc/en/Query_Cache_Status_and_Maintenance.html --- Per Andreas Buer [EMAIL PROTECTED] wrote: LS [EMAIL PROTECTED] writes: Hi- Can anyone tell me why mysql4 would prune queries from the cache if the Qcache_free_memory is still very big? I'm confused why we get so many Qcache_lowmem_prunes: Mysql will prune queries if the tables are updated, maybe this is what you are experiencing? -- Per Andreas Buer -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: upgrading to v 4.1
4.8-STABLE and linuxthreads-2.2.3_10 and gcc3.2 It's easy for me to reproduce this bug on my system, but I don't know if I could come up with a simple test case for someone to play with. Do you compile with the BUILT_OPTIMIZED flag? --- Jeremy Zawodny [EMAIL PROTECTED] wrote: On Wed, May 28, 2003 at 03:42:24PM -0700, LS wrote: I don't know about Mac OS X, but I can tell you that with 4.1 on FreeBSD w/LinuxThreads, my application's query threads get hung up almost instantly, requiring a kill -9. When I back down to 4.0.13 (and 3.23), I don't see that particular problem anymore. So keep an eye out for how it behaves for you on Max OS X under load. Which version of FreeBSD and LinuxThreads are you using? I've never experienced that bug before. Jeremy -- Jeremy D. Zawodny | Perl, Web, MySQL, Linux Magazine, Yahoo! [EMAIL PROTECTED] | http://jeremy.zawodny.com/ MySQL 4.0.8: up 114 days, processed 3,574,536,636 queries (360/sec. avg) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MySQL Connector/J 3.0.8 STABLE Has Been Released
Where does Connector/J fit into the MySQL3.23.x versus MySQL4.x client libraries? Someone mentioned to me today that mod_php is still compiled with the old 3.23 client even though it may be talking to a 4.x server, so I'm wondering if Connector/J does anything different depending on whether it's talking to a 3.23 server or a 4.x server. --- Mark Matthews [EMAIL PROTECTED] wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, MySQL Connector/J 3.0.8, a new version of the Type-IV all-Java JDBC driver for MySQL has been released. It is now available in source and binary form from the Connector/J download pages at http://www.mysql.com/downloads/api-jdbc-stable.html and mirror sites. Note that not all mirror sites may be up to date at this point of time - if you can't find this version on some mirror, please try again later or choose another download site. - From the changelog: - Allow bogus URLs in Driver.getPropertyInfo(). - Return list of generated keys when using multi-value INSERTS with Statement.getGeneratedKeys(). - Use JVM charset with filenames and 'LOAD DATA [LOCAL] INFILE' - Fix infinite loop with Connection.cleanup(). - Changed Ant target 'compile-core' to 'compile-driver', and made testsuite compilation a separate target. - Fixed result set not getting set for Statement.executeUpdate(), which affected getGeneratedKeys() and getUpdateCount() in some cases. - Unicode character 0x in a string would cause the driver to throw an ArrayOutOfBoundsException (Bug #378) - Return correct amount of generated keys when using 'REPLACE' statements. - Fix problem detecting server character set in some cases. - Fix row data decoding error when using _very_ large packets. - Optimized row data decoding. - Issue exception when operating on an already-closed prepared statement. - Fixed SJIS encoding bug, thanks to Naoto Sato. - Optimized usage of EscapeProcessor. - Fixed numbering of KEY_SEQ column in DBMD.getImported/Exported keys (thanks to Dave Schoorl). - Allow multiple calls to Statement.close() - Use hex escaping for PreparedStatement.setBytes()/setBinaryStream() when the character set is Shift_JIS, workaround for parsing bug in server. - Added whitespace insensitivity to EscapeProcessor. Have fun with it! -Mark - -- For technical support contracts, visit https://order.mysql.com/?ref=mmma __ ___ ___ __ / |/ /_ __/ __/ __ \/ / Mark Matthews [EMAIL PROTECTED] / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java /_/ /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA ___/ www.mysql.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.1 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQE+1SYqtvXNTca6JD8RAnCdAKCx+3ldUwo/kYDC5oBk5h4iepmIxgCdFi9d FMLHyUOxQBmx8gN1nVUlnp8= =toBB -END PGP SIGNATURE- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: upgrading to v 4.1
I don't know about Mac OS X, but I can tell you that with 4.1 on FreeBSD w/LinuxThreads, my application's query threads get hung up almost instantly, requiring a kill -9. When I back down to 4.0.13 (and 3.23), I don't see that particular problem anymore. So keep an eye out for how it behaves for you on Max OS X under load. --- Ted Rogers [EMAIL PROTECTED] wrote: Is it recommended that I upgrade MySQL 3.23.53 to 4.1.x? Are then any special notes I might remember when doing so? (Mac OS X Server 10.2.6) Ted -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: upgrading to v 4.1
No, in my case, both queries report being in Connect state and just stay there. Something like this: | 14376 | unauthenticated user | 10.0.48.147 | | Connect | | login | | | 14416 | unauthenticated user | 10.0.48.147 | | Connect | | login Googling around on this I see various people have run into something similar from time to time, so perhaps it's an old bug that has been reintroduced in the 4.1alpha code --- Jocelyn Fournier [EMAIL PROTECTED] wrote: Hi, What do you call hung up ? All query appearing in opening table state when doing a show processlist ? If this is the case, I'm experiencing the same problem here with Linux. Regards, Jocelyn - Original Message - From: LS [EMAIL PROTECTED] To: Ted Rogers [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, May 29, 2003 12:42 AM Subject: Re: upgrading to v 4.1 I don't know about Mac OS X, but I can tell you that with 4.1 on FreeBSD w/LinuxThreads, my application's query threads get hung up almost instantly, requiring a kill -9. When I back down to 4.0.13 (and 3.23), I don't see that particular problem anymore. So keep an eye out for how it behaves for you on Max OS X under load. --- Ted Rogers [EMAIL PROTECTED] wrote: Is it recommended that I upgrade MySQL 3.23.53 to 4.1.x? Are then any special notes I might remember when doing so? (Mac OS X Server 10.2.6) Ted -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Calendar - Free online calendar with sync to Outlook(TM). http://calendar.yahoo.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
i have question
hi; i tried to download the file mysqlDBD but how to find GNU zipping program? thnks leo