-
Notifications
You must be signed in to change notification settings - Fork 452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy to Oracle Pool Datasource connection #444
Comments
@AnuradhaBose Do you have a docker solution to reproduce the problem. I don't have any information about Oracle Pool Datasource, You can try to setup different toxics like Bandwidth, if latency is not working properly. Using tools like TCPDump and lsof would help understand if you application uses Toxiproxy or doing direct connection DB.
I would think you can add Toxics before application start and verify if it is working during the boot? |
Hi @miry - The toxics maybe working during the boot, but my need is to chaos test the database by adding toxics during the API calls, when there are Database transactions being done. Considering the fact that in Oracle DataSource Pool connections, the database connections are made only once (in this case during the application start up) and in the subsequent API calls, these connection objects are being used to query the database or save data, is there a way in which ToxiProxy could add toxics dynamically to these already created connection objects or in their subsequent database operations? This design pattern of creating connection pools for acquiring database connection objects are very common in today's world, this helps reuse of the same connection objects instead of having to connect to database multiple times. In this scenario, could you please suggest a way where we could carry out chaos tests for database calls. Is there any workaround. |
@AnuradhaBose Toxiproxy add toxic to existen connections. Example application connected to the Proxy by port 1000, then add toxic with client. the changes would apply to current open connections on the fly without reconnection. |
Hi @miry - How do I add proxy to an existing connection? Currently, I am creating a proxy on the database hostname and port. Say for example the database hostname is phxecs1.phoenixvcn.oraclevcn.com and port is 1521, I am creating a proxy to this, and then replacing the database url with the proxy url instead of the actual db host. Something like this- jdbc:oracle:thin:@(DESCRIPTION=(CONNECT_TIMEOUT=90)(RETRY_COUNT=20)(RETRY_DELAY=4)(ADDRESS_LIST=(LOAD_BALANCE=ON)(ADDRESS=(PROTOCOL=TCP)(HOST=ToxiProxy.internal.com)(PORT=8083)))(CONNECT_DATA=(SERVICE_NAME=chubd.phxecs1.phoenixvcn.oraclevcn.com)(SERVER=DEDICATED))). Now the application which is creating the connection is using Oracle Datasource Pool, and it is creating the connections during the application start up, which I have explained in the comments above. For doing the database operations, the application is using the same connection object from the pool and executing the database queries. Is there any way to add toxicities to these already created connections? As per my understanding, to create a database proxy we need the database hostname and port. This works only when the code is creating a DB connection every time it is executing a query. But in this case, since the connection objects are already existing (it also has toxicities added via proxy) but this is not reflecting in the subsequent database calls, since the connection is created only once during application start, |
I would start first to check if your application uses Toxiproxy.
Toxic
Tests
I collected some examples how to use toxiproxy-server and toxiproxy-cli in https://github.com/Shopify/toxiproxy/blob/master/scripts/test-e2e and https://github.com/Shopify/toxiproxy/blob/master/scripts/test-e2e-hazelcast PS: I would first start with something simple, example Redis.
|
Hi @miry - I have already used ToxiProxy and have done many experiments on http endpoints as well as database. The proxy to the database host works fine, and the toxicities added to the proxy also works as well, there is no doubt. |
Toxiproxy does not know about any protocols. If you know that you use Toxiproxy and in logs you see communication, If you can provide an small example with Docker, |
Hi @miry - I have one more question, does the ToxiProxy toxicities work only during database connection establishment? Or can we add latency during the step of executing a query from the java code- Statement statement = connection.createStatement(); |
I answered this question in #444 (comment) TLDR: Toxic applied to existent and new connections. To test this behavior I provide steps in #444 (comment) (check a small redis experiment) TIPS: Sometime DB clients has cache mechanism (no db calls and use in memory cache). |
Hi @miry - I tried to do a small PoC to test out the effect of ToxiProxy on Database Connection Pools. The toxicities added to the proxy, is only effective when the physical connections are made to the database via TCP. Once the connections are established the latency has no effect on the logical connections. In most applications on production, the Connection Pools are used and in 98% of cases, an existing connection is used to perform a DB operation. Do you have any idea on how we could chaos test such applications during runtime? Here is some background on Connection Pooling- Opening a physical connection to a database involves establishing a TCP/IP connection, negotiating session parameters (from the protocol), and authenticating the user. User authentication can require considerable processing for heavy cryptographic key generation. Worse, each of these steps requires a remote procedure call (RPC), which entails a network round-trip to the database with the implied network latency. Achieving maximum application uptime without interruptions requires outage detection, transparent planned maintenance, and balancing the workload. All of these factors critically influence application availability and performance. Connection pooling is an effective means of handling these concerns. Just as critically, connection pooling lets us re-use connections rather than starting a new one each time a request is made. Connection pooling minimizes the use of resources in both the client and the database. The client only needs to access a pool of active connections, which is shared by a larger number of clients. In the database, each active connection allocates a set of resources—both in memory and in the CPU—that can be minimized by using a pool in the client. When using Oracle Universal Connection Pool (UCP), a Java developer opens and closes connections only at the logical level. Connections are kept active in the pool and borrowed and returned to the pool as needed. |
Hi Team,
I have been using ToxiProxy for quite sometime to proxy http endpoints and it is working fine.
I have a new requirement of creating a proxy to the Oracle Database. The database connection is being created using the Oracle PoolDataSource during the application start up, and during the API execution, these connection pools are being used to add/update data into the Database.
I have created a proxy to the database host and port, and the connection is being established fine. The problem is that, since our application is using the Pooled Data Source connections which are being created during the application start-up itself, the subsequent calls where the DB transactions are being done, does not have any impact on any toxic (latency or timeout) that is being added to the proxy. In short, I am not being able to make use of the features of ToxiProxy when the Oracle Connection is being used as a Pooled DataSource connection.
Note: If an application creates a new connection every time for a database operation, in such a case the latency added to the proxy is visible, the api takes longer time than usual. But if the connection is made only once during startup and the oracle PoolDataSource connection is being used to do the DB operations, instead of creating the physical connection every time, the latency added to the proxy does not have any impact. The application makes use of a connection already available in the Pool of connections and does the operation.
Have you come across any such scenario and can you help me find a workaround for this. We are trying to setup this scenario into one of our applications for a chaos test and we are stuck at this point.
The text was updated successfully, but these errors were encountered: