Thread Safety
From KallestadWiki
The big question of whether to create a database connection pool based on POE or based on Perl threads comes down to one question:
- Will end users be able to use it easily?
Certainly POE will require POE to be installed. POE is a module though, and enabling Perl threading requires that Perl be compiled in such a manner that it will support threads. Score 1 for POE. It's easier at this point.
Another deciding factor is MySQL. Quoting from the DBD::mysql POD
The multithreading capabilities of DBD::mysql depend completely on the underlying C libraries: The modules are working with handle data only, no global variables are accessed or (to the best of my knowledge) thread unsafe functions are called. Thus DBD::mysql is believed to be completely thread safe, if the C libraries are thread safe and you don't share handles among threads.
The obvious question is: Are the C libraries thread safe? In the case of MySQL the answer is "mostly" and, in theory, you should be able to get a "yes", if the C library is compiled for being thread safe (By default it isn't.) by passing the option -with-thread-safe-client to configure. See the section on How to make a threadsafe client in the manual.
This is another score for a POE based solution. Most people do not compile their own MySQL version, and requiring custom compile options for both Perl and MySQL for basic KDF functionality is not something I want to do.
[edit]
Database Connection Pooling Topics
- Database Pool
- Development Concerns
- Thread Safety
- POE
- POE DB Modules
- Design Overview
[edit]
Kallestad Development Framework Topics
- KDF Home
- Project Overview
- Technical Information
- Licensing
