Server app+Client app+Database
Posted: Tue Jul 07, 2015 5:42 pm
I am working on a CATI application (Computer Assisted Telephone Interviewing). Currently, this is my setup:
1. There is an application that functions as the records server. It listens on a particular port for record requestss.
All of the records are currently held in an array in memory.
2. There is a client application which exists at the interviewers' stations.
Here is the process:
-client computer requests a number to the server
-server goes through an algorithm to find an appropriate record and sends it to the client (and prevents others from getting it until returned)
-once the call is complete the interviewer returns the record with the results
-server saves the updated information and requeues the record as appropriate
Problems:
-If there are periods of inactivity, sometimes we cannot connect to the server unless I close and restart it.
-The project sizes are growing, so I really need to start using a database to store records instead of just using the arrays.
Idea 1:
-Store records in a MySQL database.
-Keep just the most relevant information in arrays in the server app to make the appropriate decisions as to which record to use next.
-Server tells client the record ID# and then the client retrieves the record and later updates it.
I like idea 1, but it doesn't address my connectivity issues with the server app.
Idea 2:
-Store records in a MySQL database.
-Ditch the server app.
-Put the algorithm for selecting the next appropriate record into the client.
-Client decides which record to use, pulls it down and returns it to the DB.
My issue with idea 2, is how do I guarantee that 2 clients do not end up with the same record? Is there a way to immediately lock a record once it is queried?
1. There is an application that functions as the records server. It listens on a particular port for record requestss.
All of the records are currently held in an array in memory.
2. There is a client application which exists at the interviewers' stations.
Here is the process:
-client computer requests a number to the server
-server goes through an algorithm to find an appropriate record and sends it to the client (and prevents others from getting it until returned)
-once the call is complete the interviewer returns the record with the results
-server saves the updated information and requeues the record as appropriate
Problems:
-If there are periods of inactivity, sometimes we cannot connect to the server unless I close and restart it.
-The project sizes are growing, so I really need to start using a database to store records instead of just using the arrays.
Idea 1:
-Store records in a MySQL database.
-Keep just the most relevant information in arrays in the server app to make the appropriate decisions as to which record to use next.
-Server tells client the record ID# and then the client retrieves the record and later updates it.
I like idea 1, but it doesn't address my connectivity issues with the server app.
Idea 2:
-Store records in a MySQL database.
-Ditch the server app.
-Put the algorithm for selecting the next appropriate record into the client.
-Client decides which record to use, pulls it down and returns it to the DB.
My issue with idea 2, is how do I guarantee that 2 clients do not end up with the same record? Is there a way to immediately lock a record once it is queried?