Connection pool for per application server instead of per application - glassfish

I would like to replace glassfish connection pool with another connection pool implementation in order to create more dynamic configurations. I have a lot application at the same server. I do not want to create a connection pool for each application because of the connection count can be dramatically increase by the application count. What is the best way in order to provide a common application pool for the application server. Maybe as a side note I am using Spring and BoneCP will be used as a connection pool replacement.
Thanks

I'm not sure if you can exchange the internal connection pool of an application server. It sounds like exchanging some internals that aren't meant to be exchanged. However you can just ignore the application server connection pool and use your own connection pool.
One of my colleages was using DBCP in his projects so that the testcases can be run without an JNDI connection. He just initiated the connections directy with his spring context through dbcp.
The downside with this solution is that you will loose the central application server configuration facility.

Related

Questions about SignalR Connection

All,
I am using SignalR (.net 6) and have couple of questions about SignalR Connections (specifically SignalR connections that use web sockets):
Q #1)
If the SignalR client crashes, will SignalR server dispose the underlying connection automatically for me (and the OnDisconnectedAsync() event will be fired)?
The idea is to dispose client resources (on the server, resource ex: NHibernate session) that are tied to each connection.
My Tests Indicate (on local machine, both server and client):
I tried to simulate this scenario where I had a running client which then I shut down with Task manager and the minute Windows released resources for the process, the SignalR server somehow detected that connection was lost and released the connection and OnDisconnectedAsync() was called. I am not sure if my test was sufficient for this use case (client crash). I am curious of how did the server know, was it the fact the maybe the finalizer for client connection ran?
Q #2) If the current connection between client and server is broken or interrupted and SignalR needs to reconnect, and it successfully reconnects, does it use the same connection (with the same connection ID/same web socket) or does it attempt create new connection (tied to a new web socket)?
https://learn.microsoft.com/en-us/aspnet/core/signalr/configuration?view=aspnetcore-6.0&tabs=dotnet
The server considers the client disconnected if it hasn't received a message (including keep-alive) in this interval. It could take longer than this timeout interval for the client to be marked disconnected due to how this is implemented. The recommended value is double the KeepAliveInterval value.
It assigns a new connection id. Consider using other data to track which user is it, eg. Checking in the on connect and on disconnect methods.
https://learn.microsoft.com/en-us/aspnet/core/signalr/groups?view=aspnetcore-6.0

How to configure GlassFish connection pool in order to work with multiple Databases?

Well, My WebApp uses several databases and I'm trying to use GlassFish connection pool to manage the connections, but I've found configuration examples that use only one database.
So, what should I do? Create as many connection pools as databases I'm using or is there a way to configure a pool with multiple databases?
A connection pool connects to only one database (or cluster), so if you need access to different data stores you will need to set up several connection pools. One for each data store.

Database datasource binding for multiple app and instance

We use a single mysql database for 2 applications. One of this application has 2 instances.
So we would like to know how cloudbees manage the connexion pool between all these apps. I saw in other threads that mysql default conf on cloudbees accept 20 connections. For the moment, we use "old" hibernate configuration with explicite c3p0 but we thought that they could try to open too much connexions on the db.
If we change the conf to use jndi cloudbees datasource (as describ here https://developer.cloudbees.com/bin/view/RUN/DatabaseGuide), should our apps share the same connection pool ? Or at least all instances of each app ?
Hope it's understandable. Let me know if not.
Thanks for your help,
Each instance of the app has its own connection pool - so you need to consider that in sizing the pool.

Connection sharing in JCA glassfish

I have a misunderstanding regarding the connection handle sharing in JCA.
I want to know if the connection sharing only happens during a phase of transaction ( multiple components call ) or the connection sharing is possible amongst multiple clients accessing a component that has the same EIS destination.
I created my own resource adapter on Glassfish application server 3.1. The problem is the resource adapter doesn't perform any connection sharing (no associateConnection method call).
Thanks,

wcf slow connection and number of connections in the pool

I have a wcf client.
The client calls a function and then closes.
If I use netstat there is only one connection.
I made an experiment.
In the server function I put Thread.sleep(10000).
Then again I started the client.
With netstat I found out that there are 5 connections.
Why when the response is slow the client opens more connections than one ?
Regards
Nettcp connection are pooled and if you had your process running for a while then you see that these would be reused and a new one would be created if an existing one is being used and returned to the pool. So your usage will determine how the pool functions.
http://kennyw.com/work/indigo/173