You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by LuisLo <he...@gmail.com> on 2018/09/07 08:28:17 UTC

Pool connections in karaf 4.2.0

We are making a migration of our application to version 4.2.0
We have verified that in the previous version (karaf 4.0.7) multiple
connections were made to the database when starting the web application:

postgres=# select datid, datname, usename, application_name, client_addr
from pg_stat_activity where datname='ajal_db';
 datid | datname | usename | application_name |  client_addr
-------+---------+---------+------------------+----------------
 16395 | ajal_db | ajal    |                  | 172.24.208.100
 16395 | ajal_db | ajal    |                  | 172.24.208.100
 16395 | ajal_db | ajal    |                  | 172.24.208.100
 16395 | ajal_db | ajal    |                  | 172.24.208.100
 16395 | ajal_db | ajal    |                  | 172.24.208.100
 16395 | ajal_db | ajal    |                  | 172.24.208.100
 16395 | ajal_db | ajal    |                  | 172.24.208.100
(7 rows)


In the new application (karaf 4.2.0):
postgres=# select datid, datname, usename, application_name, client_addr
from pg_stat_activity where datname='ajal_db';
 datid | datname | usename | application_name |  client_addr
-------+---------+---------+------------------+----------------


We also check that the application is slower.

Using H2 we can see that the lock.db file is created and destroyed after
each query.This did not happen in version 4.0.7, where the file is always
created.

The datasource configFile:
#Postgres
url = jdbc:postgresql://172.24.208.100:5432/cecom
osgi.jdbc.driver.name = PostgreSQL JDBC Driver
user = ajal
password = 

pool=dbcp2




--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Pool connections in karaf 4.2.0

Posted by LuisLo <he...@gmail.com>.
Hi,
I have created the configuration file manually, following the example of
pax-jdbc.
org.ops4j.datasource-test.cfg

la command:

START LEVEL 100 , List Threshold: 0
 ID ? State    ? Lvl ? Version              ? Name
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
  0 ? Active   ?   0 ? 5.6.10               ? System Bundle, Fragments: 1
  1 ? Resolved ?   1 ? 4.2.0                ? Apache Karaf :: Features ::
Extension, Hosts: 0
  2 ? Active   ?   5 ? 1.1.6                ? Apache Felix Metatype Service
  3 ? Active   ?   5 ? 4.2.0                ? Apache Karaf :: OSGi Services
:: EventAdmin
  4 ? Active   ?   5 ? 2.5.4                ? OPS4J Pax Url - aether:
  5 ? Active   ?   8 ? 1.17.0               ? jansi
  6 ? Active   ?   8 ? 1.10.1               ? OPS4J Pax Logging - API
  7 ? Active   ?   8 ? 1.10.1               ? OPS4J Pax Logging - Log4j v2
  8 ? Active   ?  10 ? 1.8.16               ? Apache Felix Configuration
Admin Service
  9 ? Active   ?  11 ? 3.6.4                ? Apache Felix File Install
 10 ? Active   ?  15 ? 4.2.0                ? Apache Karaf :: Features ::
Core
 11 ? Active   ?   5 ? 2.5.4                ? OPS4J Pax Url - wrap:
 13 ? Active   ?  30 ? 1.9.2.1              ? Apache ServiceMix :: Bundles
:: jasypt
 14 ? Active   ?  80 ? 1.2.0                ? OPS4J Pax JDBC Generic Driver
Extender
 15 ? Active   ?  80 ? 1.2.0                ? OPS4J Pax JDBC Config
 16 ? Active   ?  80 ? 1.2.0                ? OPS4J Pax JDBC Pooling Support
Base
 17 ? Active   ?  80 ? 1.0.0.201505202023   ? org.osgi:org.osgi.service.jdbc
 18 ? Active   ?  80 ? 1.3.4                ? ClassMate
 19 ? Active   ?  80 ? 2.1.4                ? Jackson-annotations
 20 ? Active   ?  80 ? 2.1.4                ? Jackson-core
 21 ? Active   ?  80 ? 2.1.4                ? jackson-databind
 22 ? Active   ?  80 ? 2.7.0                ? Gson
 23 ? Active   ?  80 ? 57.1                 ? ICU4J
 24 ? Active   ?  80 ? 5.1.34               ? Oracle Corporation's JDBC
Driver for MySQL
 25 ? Active   ?  80 ? 1.2.0                ? JavaBeans Activation Framework
 26 ? Active   ?  80 ? 3.0.0                ? Expression Language 3.0
 27 ? Active   ?  80 ? 3.23.1.GA            ? Javassist
 28 ? Active   ?  80 ? 1.2.0                ? JavaBeans Activation Framework
API jar
 29 ? Active   ?  30 ? 1.2                  ? javax.annotation API
 30 ? Active   ?  80 ? 1.2.0                ? CDI APIs
 31 ? Active   ?  80 ? 1.2                  ? javax.interceptor API
 32 ? Active   ?  30 ? 1.4.4                ? JavaMail API (compat)
 33 ? Active   ?  80 ? 2.2                  ? Java(TM) Persistence API jar
 34 ? Active   ?  30 ? 3.1.0                ? Java Servlet API
 35 ? Active   ?  80 ? 1.2                  ? javax.transaction API
 36 ? Active   ?  80 ? 1.1.0.Final          ? Bean Validation API
 37 ? Active   ?  80 ? 2.0.1.Final          ? Bean Validation API
 38 ? Active   ?  30 ? 1.1                  ? WebSocket server API
 39 ? Active   ?  80 ? 20160810.0.0         ? JSON in Java
 40 ? Active   ?  80 ? 1.1.3                ? ModelMapper
 41 ? Active   ?  80 ? 1.8.17               ? Byte Buddy (without
dependencies)
 42 ? Active   ?  80 ? 6.4.1                ? JasperReports Library
 43 ? Active   ?  20 ? 1.0.1                ? Apache Aries Blueprint API
 44 ? Active   ?  20 ? 1.2.0                ? Apache Aries Blueprint CM
 45 ? Active   ?  20 ? 1.9.0                ? Apache Aries Blueprint Core
 46 ? Active   ?  30 ? 1.1.5                ? Apache Aries JMX API
 47 ? Active   ?  30 ? 1.2.0                ? Apache Aries JMX Blueprint API
 48 ? Active   ?  30 ? 1.2.0                ? Apache Aries JMX Blueprint
Core
 49 ? Active   ?  30 ? 1.1.8                ? Apache Aries JMX Core
 50 ? Active   ?  30 ? 1.2.0                ? Apache Aries Whiteboard
support for JMX DynamicMBean services
 51 ? Active   ?  30 ? 1.1.0                ? Apache Aries JNDI API
 52 ? Active   ?  30 ? 1.0.2                ? Apache Aries JNDI Core
 53 ? Active   ?  30 ? 1.0.0                ? Apache Aries JNDI Support for
Legacy Runtimes
 54 ? Active   ?  30 ? 1.0.0                ? Apache Aries JNDI RMI Handler
 55 ? Active   ?  30 ? 1.1.0                ? Apache Aries JNDI URL Handler
 56 ? Active   ?  30 ? 2.6.1                ? Apache Aries JPA Container API
 57 ? Active   ?  30 ? 2.6.1                ? Apache Aries JPA blueprint
 58 ? Active   ?  30 ? 2.6.1                ? Apache Aries JPA container
 59 ? Active   ?  30 ? 2.6.1                ? Apache Aries JPA support
 60 ? Active   ?  20 ? 1.1.1                ? Apache Aries Proxy Service
 61 ? Active   ?  30 ? 1.0.10               ? Apache Aries SPI Fly Dynamic
Weaving Bundle
 62 ? Active   ?  80 ? 1.1.1                ? Apache Aries Transaction
Blueprint
 63 ? Active   ?  80 ? 2.1.0                ? Apache Aries Transaction
Blueprint
 64 ? Active   ?  20 ? 1.1.3                ? Apache Aries Util
 65 ? Active   ?  80 ? 1.9.3                ? Apache Commons BeanUtils
 66 ? Active   ?  30 ? 1.10.0               ? Apache Commons Codec
 67 ? Active   ?  80 ? 3.2.1                ? Commons Collections
 68 ? Active   ?  80 ? 1.10.0               ? Apache Commons Configuration
 69 ? Active   ?  80 ? 2.1.1                ? Apache Commons DBCP
 70 ? Active   ?  80 ? 2.1                  ? Commons Digester
 71 ? Active   ?  80 ? 2.4                  ? Commons Lang
 72 ? Active   ?  80 ? 3.7.0                ? Apache Commons Lang
 73 ? Active   ?  80 ? 2.4.2                ? Apache Commons Pool
 74 ? Active   ?  80 ? 1.2.0                ? Apache Commons Text
 75 ? Active   ?  30 ? 1.0.2                ? Apache Felix Coordinator
Service
 76 ? Active   ?  30 ? 1.0.4                ? Apache Felix Inventory
 77 ? Active   ?  30 ? 2.0.14               ? Apache Felix Declarative
Services
 78 ? Active   ?  30 ? 2.0.8                ? Apache Felix Web Console
Service Component Runtime/Declarative Services Plugin
 79 ? Active   ?  30 ? 1.1.8                ? Apache Felix Web Console Event
Plugin
 80 ? Active   ?  30 ? 1.0.8                ? Apache Felix Web Console
Memory Usage Plugin
 81 ? Active   ?  30 ? 1.1                  ? Java Authentication SPI for
Containers
 82 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Bundle ::
BlueprintStateService
 83 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Bundle :: Core
 84 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: ConfigAdmin ::
Core
 85 ? Active   ?  24 ? 4.2.0                ? Apache Karaf :: Deployer ::
Blueprint
 86 ? Active   ?  26 ? 4.2.0                ? Apache Karaf :: Deployer ::
Features
 87 ? Active   ?  24 ? 4.2.0                ? Apache Karaf :: Deployer ::
Karaf Archive (.kar)
 88 ? Active   ?  24 ? 4.2.0                ? Apache Karaf :: Deployer ::
Wrap Non OSGi Jar
 89 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Diagnostic ::
Core
 90 ? Active   ?  80 ? 4.2.0                ? Apache Karaf :: OSGi Services
:: Event
 91 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Features ::
Command
 92 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: HTTP :: Core
 93 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Instance ::
Core
 94 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: JAAS ::
Blueprint :: Config
 95 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: JAAS ::
Blueprint :: Jasypt
 96 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: JAAS ::
Command
 97 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: JAAS :: Config
 98 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: JAAS :: Jasypt
Encryption
 99 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: JAAS ::
Modules
100 ? Active   ?  80 ? 4.2.0                ? Apache Karaf :: JDBC :: Core
101 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: JNDI :: Core
102 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: KAR :: Core
103 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Log :: Core
104 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Management
105 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Package ::
Core
106 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Scheduler ::
Core
107 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: SCR ::
Management MBeans
108 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: SCR :: Bundle
State
109 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Service ::
Core
110 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Shell ::
Various Commands
111 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Shell :: Core
112 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Shell :: SSH
113 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: System :: Core
114 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Web Console ::
Console
115 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Web Console ::
Features Plugin
116 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Web Console ::
Gogo Plugin
117 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Web Console ::
HTTP Plugin
118 ? Active   ?  30 ? 4.2.0                ? Apache Karaf :: Web Console ::
Instance Plugin
119 ? Active   ?  80 ? 2.2.12               ? Apache MyFaces JSF-2.2 Core
API
120 ? Active   ?  80 ? 2.2.12               ? Apache MyFaces JSF-2.2 Core
Impl
121 ? Active   ?  80 ? 2.7.7.5              ? Apache ServiceMix :: Bundles
:: antlr
122 ? Active   ?  80 ? 0.9.5.2_1            ? Apache ServiceMix :: Bundles
:: c3p0
123 ? Active   ?  80 ? 3.2.4.1              ? Apache ServiceMix :: Bundles
:: cglib
124 ? Active   ?  80 ? 1.8.0.4              ? Apache ServiceMix :: Bundles
:: commons-digester
125 ? Active   ?  80 ? 1.6.1.5              ? Apache ServiceMix :: Bundles
:: dom4j
126 ? Active   ?  80 ? 1.0.0.2              ? Apache ServiceMix :: Bundles
:: javax.inject
127 ? Active   ?  30 ? 0.3.11.1             ? Apache ServiceMix :: Bundles
:: not-yet-commons-ssl
128 ? Active   ?  30 ? 1.7.0                ? Apache Mina SSHD :: Core
129 ? Active   ?  80 ? 4.6.0                ? Apache XBean OSGI Bundle
Utilities
130 ? Active   ?  80 ? 4.6.0                ? Apache XBean :: Classpath
Resource Finder
131 ? Active   ?  30 ? 4.7.0                ? Apache XBean :: Naming
132 ? Active   ?  80 ? 3.9.1.v20130905-0837 ? Eclipse Compiler for Java(TM)
133 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Asynchronous HTTP
Client
134 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Continuation
135 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Deployers
136 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Http Utility
137 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: IO Utility
138 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: JAAS
139 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: JMX Management
140 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: JNDI Naming
141 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Plus
142 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Rewrite Handler
143 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Security
144 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: JASPI Security
145 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Server Core
146 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Servlet Handling
147 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Utility Servlets and
Filters
148 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Utilities
149 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Utilities ::
Ajax(JSON)
150 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Webapp Application
Support
151 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Websocket :: API
152 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Websocket :: Client
153 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Websocket :: Common
154 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Websocket ::
javax.websocket :: Client Implementation
155 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Websocket ::
javax.websocket.server :: Server Implementation
156 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Websocket :: Server
157 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: Websocket :: Servlet
Interface
158 ? Active   ?  30 ? 9.4.6.v20170531      ? Jetty :: XML utilities
159 ? Active   ?  80 ? 1.3.172              ? H2 Database Engine
160 ? Active   ?  80 ? 5.0.4.Final          ? hibernate-commons-annotations
161 ? Active   ?  80 ? 5.3.6.Final          ? hibernate-core
162 ? Active   ?  80 ? 5.3.6.Final          ? hibernate-osgi
163 ? Active   ?  80 ? 6.0.9.Final          ? Hibernate Validator Engine
164 ? Active   ?  80 ? 2.0.5.Final          ? Java Annotation Indexer
165 ? Active   ?  80 ? 3.3.2.Final          ? JBoss Logging 3
166 ? Active   ?  30 ? 3.6.2                ? JLine Builtins
167 ? Active   ?  30 ? 3.6.2                ? JLine Reader
168 ? Active   ?  30 ? 3.6.2                ? JLine Terminal, Fragments: 169
169 ? Resolved ?  30 ? 3.6.2                ? JLine JANSI Terminal, Hosts:
168
170 ? Active   ?  80 ? 1.5.9.0              ? MariaDB JDBC Client
171 ? Active   ?  20 ? 6.0                  ? ASM
172 ? Active   ?  20 ? 6.0                  ? ASM static code analysis
framework
173 ? Active   ?  20 ? 6.0                  ? ASM commons classes
174 ? Active   ?  20 ? 6.0                  ? ASM Tree class visitor
175 ? Active   ?  20 ? 6.0                  ? ASM Utilities
176 ? Active   ?  80 ? 2.1.0                ? Objenesis
177 ? Active   ?  80 ? 1.0.0                ? OPS4J Pax CDI Bean Bundle API
178 ? Active   ?  80 ? 1.0.0                ? OPS4J Pax CDI Extender for
Bean Bundles
179 ? Active   ?  80 ? 1.0.0                ? OPS4J Pax CDI Portable
Extension for OSGi
180 ? Active   ?  80 ? 1.0.0                ? OPS4J Pax CDI Service Provider
Interface
181 ? Active   ?  80 ? 1.0.0                ? OPS4J Pax CDI Web Adapter
182 ? Active   ?  80 ? 1.2.0                ? OPS4J Pax JDBC MariaDB Driver
Adapter
183 ? Active   ?  80 ? 1.2.0                ? OPS4J Pax JDBC MySQL Driver
Adapter
184 ? Active   ?  80 ? 1.2.0                ? OPS4J Pax JDBC Oracle Driver
Adapter
185 ? Active   ?  80 ? 1.2.0                ? OPS4J Pax JDBC Pooling Support
using C3P0
186 ? Active   ?  80 ? 1.2.0                ? OPS4J Pax JDBC Pooling DBCP2
187 ? Active   ?  80 ? 0.2.0                ? pax-transx-tm-api
188 ? Active   ?  80 ? 0.2.0                ? pax-transx-tm-geronimo
189 ? Active   ?  30 ? 2.5.2                ? OPS4J Pax Url - war
190 ? Active   ?  30 ? 7.0.0                ? OPS4J Pax Web - API
191 ? Active   ?  30 ? 7.0.0                ? OPS4J Pax Web - FileInstall
Deployer
192 ? Active   ?  30 ? 7.0.0                ? OPS4J Pax Web - Deployment
Descriptor Model
193 ? Active   ?  30 ? 7.0.0                ? OPS4J Pax Web - Extender - WAR
194 ? Active   ?  30 ? 7.0.0                ? OPS4J Pax Web - Extender -
Whiteboard
195 ? Active   ?  30 ? 7.0.0                ? OPS4J Pax Web - Jetty
196 ? Active   ?  30 ? 7.0.0                ? OPS4J Pax Web - Jsp Support
197 ? Active   ?  30 ? 7.0.0                ? OPS4J Pax Web - Runtime
198 ? Active   ?  30 ? 7.0.0                ? OPS4J Pax Web - Service SPI
199 ? Active   ?  80 ? 9.4.1212.jre7        ? PostgreSQL JDBC Driver JDBC41
200 ? Active   ?  80 ? 6.1.0                ? primefaces
201 ? Active   ?  80 ? 2.2.1                ? quartz



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Re: Pool connections in karaf 4.2.0

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

that's under the pax-jdbc scope as I guess you have created the
datasource using jdbc:* command right ?

Can you provide the bundles installed for pax-jdbc ? Or the output of la
command ?

Thanks,
Regards
JB

On 07/09/2018 10:28, LuisLo wrote:
> We are making a migration of our application to version 4.2.0
> We have verified that in the previous version (karaf 4.0.7) multiple
> connections were made to the database when starting the web application:
> 
> postgres=# select datid, datname, usename, application_name, client_addr
> from pg_stat_activity where datname='ajal_db';
>  datid | datname | usename | application_name |  client_addr
> -------+---------+---------+------------------+----------------
>  16395 | ajal_db | ajal    |                  | 172.24.208.100
>  16395 | ajal_db | ajal    |                  | 172.24.208.100
>  16395 | ajal_db | ajal    |                  | 172.24.208.100
>  16395 | ajal_db | ajal    |                  | 172.24.208.100
>  16395 | ajal_db | ajal    |                  | 172.24.208.100
>  16395 | ajal_db | ajal    |                  | 172.24.208.100
>  16395 | ajal_db | ajal    |                  | 172.24.208.100
> (7 rows)
> 
> 
> In the new application (karaf 4.2.0):
> postgres=# select datid, datname, usename, application_name, client_addr
> from pg_stat_activity where datname='ajal_db';
>  datid | datname | usename | application_name |  client_addr
> -------+---------+---------+------------------+----------------
> 
> 
> We also check that the application is slower.
> 
> Using H2 we can see that the lock.db file is created and destroyed after
> each query.This did not happen in version 4.0.7, where the file is always
> created.
> 
> The datasource configFile:
> #Postgres
> url = jdbc:postgresql://172.24.208.100:5432/cecom
> osgi.jdbc.driver.name = PostgreSQL JDBC Driver
> user = ajal
> password = 
> 
> pool=dbcp2
> 
> 
> 
> 
> --
> Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com