Could you also provide some "gut feeling" on what you think about multi-threaded database-apps

If your proposed concurrent accesses to the DB would be accessing the same tables, then those accesses would most likely get serialised at the DB anyway, so you will likely not see much gain from the concurrency. And potentially you may suffer degradation. This is true regardless of whether you achieve the concurrency through, threads, processes or event loop architectures. It is also true whether you use Perl or C or Java.

Whether there is any gain to be had from using threads as a part of a DB app will depend if there is anything else in the application that could usefully be processed whilst you are waiting for the DB to do its thing.

If, for example, you need to perform some calculations on one set of results, whilst quering the next set: using a thread to perform those calculations whilst the main thread waits for the results of the next query has the potential for benefits.

Likewise, if you are retrieving data for insertion from a disk or the network, then overlapping the insertion of one batch with the reading of then next batch can increase throughput.

The thing to remember is, if your multi-threaded app only communicates with the DB via one thread, then it does not matter if the DB libraries are thread-safe, because from the point of view of the DB, your app looks and acts like a single-threaded application.

Given that, and the fact that there is rarely any gain from accessing a DB concurrently for a single application due to the inherent serialisation that occurs at the DB itself, the "trick" to successfully exploiting threads in a DB application is to get away from your natural instinct to want to have multiple threads talking to the DB.

Instead, consider how to partition the processing so that your application can be doing something useful whilst it is waiting for the DB to fulfill your requests. One key to efficiency, is to query your results, or post your updates, in smaller batches to strike a balance between the time taken to prepare updates or deal with results; and the time taken to send or recieve them.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re: DBD::Oracle and threading by BrowserUk
in thread DBD::Oracle and threading by morgon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.