[
https://issues.apache.org/jira/browse/DERBY-3313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12559182#action_12559182
]
Kristian Waagan commented on DERBY-3313:
----------------------------------------
Thank you for your interest in this issue Bryan!
A logical entity is a wrapper around a "physical" entity. It is a mechanism to
avoid closing the physical entity when a user asks to close the object he/she
has a reference to. You also need to make sure that the user can't obtain a
reference to the physical entity after the logical entity has been closed. In
many scenarios this can be fatal, for instance that different worker threads in
an application server get in each others way.
The logical entity concept already exists in the driver, for instance for
connections (used when connections are pooled). I have however introduced it
for prepared statements. Oversimplified, the only thing it needs to do is
forward all calls to the physical prepared statement and possibly execute some
special logic on close. In this case, it is putting the physical prepared
statement into the cache if appropriate. The logical entity will also
release/nullify any references to its physical entity.
One physical entity will typically do work for several logical entities during
its lifespan, but at different times (non-overlapping). Further, a logical
entity is typically a lot cheaper to instantiate than a physical entity.
An illustration of this is the statement cache in the client driver. Instead of
going over the network to the server and re-prepare a statement there, you can
simply wrap the existing (physical) prepared statement in the client driver.
You save time spent in the network and time/work on the server. The actual
benefit from such a cache is of course highly dependent on the application's
usage of prepared statements.
Hope this made sense, if not, ask again!
> JDBC client driver statement cache
> ----------------------------------
>
> Key: DERBY-3313
> URL: https://issues.apache.org/jira/browse/DERBY-3313
> Project: Derby
> Issue Type: New Feature
> Components: JDBC, Network Client
> Affects Versions: 10.4.0.0
> Reporter: Kristian Waagan
> Assignee: Kristian Waagan
> Fix For: 10.4.0.0
>
> Attachments: derby-3313-1a-early_prototype.diff,
> derby-3313-1a-early_prototype.stat, JDBCClientStatementCacheOverview.txt
>
>
> A statement cache in the JDBC client driver will help increase performance in
> certain scenarios, for instance some multi-tier systems using connection
> pooling.
> Please consult the comments and documents attached to this issue for more
> information.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.