This is coming soon!

Shared connection or individual connection?

Discussion in 'Programming Help & Discussion' started by shakemelikeapig, Mar 9, 2012.

Oh noes!

You need 20 posts to be able to download resources, post links and other things. Read more...
  1. shakemelikeapig New Member

    Dear All
    I would like to ask your opinion on this. We have a java socket application which will keep receiving data from devices then each data will go through numerous different sql query selects, inserts and updates. The problem now we are looking into two solution
    Send
    1.Solution 1
    For the socket connection build one thread and read the data and enqueue. Thenan other thread called is the dbprocessor to dequeue the data and do the processing of the different sql queries. The dbprocessor thread will just share on db connection for all messages being processed.

    2. Solution 2.
    The socket connection and both db processor are all in one single thread. For each socket connection open one db connection and keep processing the sql queries for each input data and finally close the db connection.

    So which one is advice the share connection or each single d/b connection. We are using the share connection but at times the queue size becomes big and that worries us.

    sp
  2. cheeseface ¢ℓαѕѕιƒιє∂..

    I would say a shared connection to prevent too many connections at once but as you said the queue could get too big so I am clueless :(
  3. shakemelikeapig New Member

    Dear cheeseface,
    When we use shared connection right if there is more then one thread just say using the same connection will both thread be able to process their queries simultaneously or it will be like one after another? This is what I am would like to know from here?
  4. techywebuser New Member