locked
Close azure storage connection after transactions or leave it opened -- best practice RRS feed

  • Question

  • Hi all,

    What is the best practice when dealing with Azure storage? Is it to open a connection with the data storage, perform a transaction and close it as soon as possible, or leave the connection open for the lifetime of the application?

    Thanks

    Monday, August 9, 2010 3:45 PM

Answers

  • Azure Storage is REST based so it doesn't create and maintain a connection pipe per say. When you perform an operation, the request message is formatted, encrypted, and sent and a response is then looked for (either syncronously or asychronously).

    In other words, since you're not opening and closing connections in a traditional sense, IMHO the question really isn't valid.

    • Marked as answer by LAT3450 Monday, August 9, 2010 7:09 PM
    Monday, August 9, 2010 4:17 PM
  • If the question regards TableServiceContext I believe the best practice is to create contexts as needed rather than reuse a single context.
    • Marked as answer by LAT3450 Monday, August 9, 2010 7:08 PM
    Monday, August 9, 2010 5:19 PM
    Answerer

All replies

  • Azure Storage is REST based so it doesn't create and maintain a connection pipe per say. When you perform an operation, the request message is formatted, encrypted, and sent and a response is then looked for (either syncronously or asychronously).

    In other words, since you're not opening and closing connections in a traditional sense, IMHO the question really isn't valid.

    • Marked as answer by LAT3450 Monday, August 9, 2010 7:09 PM
    Monday, August 9, 2010 4:17 PM
  • If the question regards TableServiceContext I believe the best practice is to create contexts as needed rather than reuse a single context.
    • Marked as answer by LAT3450 Monday, August 9, 2010 7:08 PM
    Monday, August 9, 2010 5:19 PM
    Answerer
  • I agree with Brent. Azure storage is not managed by relational database like SQL Server(although DevFabricStorage uses SQL Server) and thus we should not think of it in terms of database semantics. Azure storage services follow the principles of WCF (aka ADO.NET) Data Services which is REST based. We can also observe that, Table's Entity Group Transactions are processed in terms of changeset and batch and there is no explicit transaction management involved.

     

    HTH,


    Please mark it as answer by clicking on "Propose As Answer", if it helps
    Monday, August 9, 2010 5:37 PM
  • Yes, the questions in regards of the TableServiceContext.

    Thanks you all for your responses.

    Monday, August 9, 2010 7:09 PM