none
In-memory Database in C#.NET.. RRS feed

  • Question

  • Hi All,

    We are planning to use In-memory DB in C# in one of our requirement. Can anybody suggest which one is the best for doing the below tasks.

    1. Looking for "File Back Up Option"

    2. Multi-threaded applications - Able to update the status of each record when we process it in individual thread.

    Looking for opensource options which can handle above tasks. Pls let me know 

    Thanks

    Vishnu


    • Edited by VishnuRao Monday, November 25, 2019 4:34 PM
    Monday, November 25, 2019 4:20 PM

All replies

  • We are planning to use In-memory DB in C# in one of our requirement. Can anybody suggest which one is the best for doing the below tasks.

    IMO, an in-memory database is a viable testing solution.  It's too volatile to be used in a production environment, becuase memory is a volatile environment. 

    I can't say that I would be asking this question in the c# forum either,  and the question would be more appropriate in a database forum.

    Monday, November 25, 2019 5:41 PM
  • Most businesses would use a SSD if they need performance. Then you get nearly as good performance with all the advantages of an external disk drive. But as has been stated, you should go elsewhere to ask. As far as I know there are no Microsoft products that are in-memory explicitly. SQLite is included with current versions of Windows but it is not a Microsoft product.


    Sam Hobbs
    SimpleSamples.Info

    Monday, November 25, 2019 7:43 PM
  • You should look into using Redis, which is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker. Azure also has fully managed Redis service if you do not want to set it up or maintain it yourself.

    You can use StackExchange.Redis which is one of best .NET libraries for working with Redis.

    There is the EF Core In-Memory Database Provider but I would only use it for testing purposes. Another option is the SQLite provider which would be more appropriate for a relational database.


    william xifaras




    Tuesday, November 26, 2019 2:17 AM
  • I have seen people ask a question in an inappropriate forum and then take the advice given there and ignore use of an appropriate forum where they are likely to get better answers.


    Sam Hobbs
    SimpleSamples.Info

    Tuesday, November 26, 2019 6:12 AM
  • Hi William,

    Thanks for your reply. I checked for SQLite Inmemory Db for my requirement.

    Mainly i am looking for below features in the same.

    1. DB should have “File Backup option”
    2. Concurrent access by multiple processes/threads reading/writing from the same DB?

    I have checked it it can do File backup , but the 2nd option i am trying to check it as in our requirement we are planning to use multi threading concept- where in each thread can update the status to the DB table . But as per the documentation - SQLite is not allowing concurrent write to the same table at the same time. 

    "SQLite allows multiple processes to have the database file open at once, and for multiple processes to read the database at once. When any process wants to write, it must lock the entire database file for the duration of its update. But that normally only takes a few milliseconds. Other processes just wait on the writer to finish then continue about their business. Other embedded SQL database engines typically only allow a single process to connect to the database at once."

    I am still looking for other DB which can allow the same..

    Thanks


    • Edited by VishnuRao Tuesday, November 26, 2019 7:24 PM
    Tuesday, November 26, 2019 7:22 PM
  • Hi VishnuRao, 

    Thank you for posting here.

    According to your problem, I have a question to confirm with you.

    Why you chose in-memory database for your requirement?

    I find that SQLServer and Access database can all backup file and handle concurrent accessing.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, November 27, 2019 8:31 AM
    Moderator
  • Actually Visual FoxPro is in-memory (do you mean "in process"?) database engine. However the last version Sedna (which supports .NET v2, and has integration with VS2005) is neither publicly available nor supported, and you can only obtain it from MSDN subscriptions.
    Wednesday, November 27, 2019 9:15 AM
    Answerer
  • SQLite is highly optimized when it comes to locking/unlocking. It is really fast and normally only takes a few milliseconds. That being said, aren't you concerned about concurrency issues?

    When using multiple threads to insert/update/query deadlocks are a fact of life.

    "We are aware of no other embedded SQL database engine that supports as much concurrency as SQLite"

    I would rethink your design as requiring multiple threads to write at the same time will be problematic.


    william xifaras

    Wednesday, November 27, 2019 2:23 PM