I am wanting to use MongoDB on my Windows Server and I am using the .NET code at:
https://github.com/atheken/NoRM/wiki/
I have 2 web servers that I need to host MongoDB on and keep the database on both instances in sync. What should I be looking at to accomplish this? It seems the master/slave replication option is ideal.
If I do this, can I keep my connection string as?
mongodb://localhost/MyDatabase?strict=false
Thanks for any help. This is my first attempt as using MongoDB.
MongoDB doesn't support this kind of peer-to-peer replication, only master-slave where data is always written to a primary database then sync'd out to secondary replicas. You can, however, distribute reads across the replicas by using the slaveOk option. Check out replica sets for more info. To distribute writes, take a look at sharding.
Also, it might not be ideal to host MongoDB and your web server on the same box. Mongo is greedy when it comes to memory, and if the database grows larger than available RAM then web server performance could really suffer.
Related
I am using System.Runtime.Caching in windows application(c#)
This works fine for single machine. Now I want to share cache between multiple instances running on different computers.
So I am thinking of using MEMCACHED or Hazelcast IMDG
Any c# implementation or idea/ results how this works. Please note I am doing this for windows application. Any other suggestion is also welcome.
Thanks
Using In memory cache, needs clear understanding of following use cases:
Is it only a memory dump ?
Does it needs Querying ability, like IQueryable, provided by the frameworks like Entity Framework for the Sql Server ?
If its only in memory dump then Redis, MemCache are fine, as they just store data in the memory as binary, de-serialized once fetched at the client location, which is not good if you are querying lots of data and want processing like filtering, sorting, pagination to be done at the source.
In case IQueryable processing is required, then check out ApacheIgnite.Net. Hazelcast and ScaleOut, out of them I find Apache Ignite to be most advanced, since it just doesn't support the Expression trees, via IQueryable, but also Ansi Sql, which is a very big advantage over other Cache
Also another point remains, why not replace Sql Server or similar database by a modern in memory system like VoltDB or Document db like Raven, as they are much faster, well integrated and completely exclude the need to separate Cache
I would suggest you to use Redis for caching purpose.
Here's a good c# library for Redis: ServiceStack.Redis
I have 5 websites running on same server and I have some sql tables that I access frequently. that was time consuming and by defining them shared I pumped them in memory. So my application is accessing those static data tables from memory quite efficiently. But I realized I did a mistake and I occupied my memory unnecessarily while I keep same tables 5 times for each web application. Now I need to find the best way to share that table only 1 time. my options are;
1) using a local database - sql CE. my original sql database is on other server. so it makes the access slower but I can add a sql CE database(to be honest I never used it and dont know if it gives me anything) to access only these tables while they have static rows.
2) I read over forums that making a WCF using tcp binding. not sure if it will give me any advantage. any idea?
3) windows service: is it faster than wcf? programming is defiantly faster as i have experience with winservice but nor sure about performance.
Please let me know if you have any comment on my ideas or any other new idea?
thanks a lot.
If you are running on Windows Server 2008, you could use Microsoft's AppFabric Server distributed caching. Here are couple of articles to give you an idea:
http://www.hanselman.com/blog/InstallingConfiguringAndUsingWindowsServerAppFabricAndTheVelocityMemoryCacheIn10Minutes.aspx
http://msdn.microsoft.com/en-us/magazine/dd861287.aspx
Right now I am having a customer who is working with several businesses. He is working with their data but is not allowed to directly access their databases. We thought of using SQLite or SQL CE and storing a copy/part of the original database as a file on a network share. Now the problem is that SQL CE is not supporting it and SQLite highly recommends not to do so.
First of all the performance is a huge problem, since our customer is working with a lot of data (up to several gb). The second problem is that SQLite has problems (actually the underlying os functionality for file locking is the problem) with concurrent usage of the database, when it is stored on a network share. I did a lot of research on that topic and many people say that it is just a matter of time that the database gets currupt.
Does anyone know a better solution to that problem or a workaroung which lets me use SQLite? It does not need to be a file based database, as long as nothing needs to be installed or run on the server.
Thanks, David.
If you are going to store data on a network share and have concurrent users accessing it you are going to need a db that can handle concurrent access. MS Access will quickly die if under concurrent access as will SQL Lite.
SQL Server Express is free and works very well. PostgreSQL as suggested by Maxim is an open source full featured db that will do the job very well but may be overkill.
You could also look at Redis ... fast lightweight in memory no sql db that also has capability to persist to file.
You can try PostgreSQL. It is very easy to configure, and is rather reliable. It also support server export/import options.
And any of this makes sense, if you client is able to get his hands on an exported database somehow.
I have 1 application , in which conditions are like i have to use local databases only for each PC....Now if some enrollment is done from 1 pc then that data should be store in local database and also it should be send to another PC...in short i want to synchronise all the data..
I need to clear 1 thing that "Centralize database is not possible..I cant use 1 database and connect to it from all PC.."So i need synchronization only...
I am using SQL SERVER Express Edition...
and developing application in C# .NET
If have any doubt you can ask me i will describe more...
Since you're using SQL Server Express, replication is not an option. (Express versions can only subscribe in a replication scenario.) But you should take a look at the Sync Framework, formerly known as Sync Services for ADO.NET. It is an API for .NET that provides the kind of db sync capabilities which you may find helpful. From your description, the Collaboration Scenario seems the most applicable (peer-to-peer synchronization scenario.)
Just a thought, if you really want data redundancy, looking at something like cassandra might be a better alternative.
I will be building an in-house, Occasionally Connected App (OCA). What technologies would you suggest I employ.
Here are my parameters:
.NET Shop(3.5sp1)
C# for code behind (winform,wpf,silverlight)
SQL Server Backend (2005 or possibly 2008 pending approval)
Solo Developer
Solo SQL Administrator
Low Tech end users
Low bandwidth to 5 Branch offices
This is a LOB app but not a POS.
Majority of users have laptops that they take to Member's Home
The Data for this App is stored in 5 separate Databases, though in one SQL instance.
I am looking for specific recommendations on which path to choose. Merge Replication or Sync Framework database synchronization providers? SQL Express or SQL CE at the Subscriber? Can I use LINQ to SQL for the DAL?
Is a Silverlight 'Offline/Out of Browser App' Example Here, feasible?
This is my first LARGE business application so any experienced comments are welcome.
As requested here is some additional info on the type of Data. My users are Nurses and Social Workers who go to Member's homes and create "Plans" or "Health Assessment Reviews" for them. These are things like a Medication List or a List of there current "Providers". Steps to achieve members' goals or a list of there current/past Diagnosis's. Things like that.
Also the typical Members Name, Address, Phone Number, etc. Mostly this is a Data Storage and Retrieval app that facilitates reporting. Very little "processing" takes place and Nurses and Social Workers work in teams that are assigned members so I usually have very little crossover or potential data conflicts. Nurses and SW's also are responsible for different area's of the MCP(Member Centered Plan)
Additional question; Is Sync Framework really only a viable option if I can use SQL 2008? Seems that way due to the Change Tracking etc....thoughts?
Once you solve the problem of change detection and data movement, everything else is trivial. In other words technologies like WPF, Silverlight, Forms and even WCF are orthogonal to your main problem and your choice should be based on your personal preferences and experience. The real hard nut to crack is working disconnected and synchronizing changes. Which leaves two out-of-the-box avenues: Synch Framework or Replication.
I would say, for your scenario, definetely Synch Framework. Merge replication, like all forms of replication, is designed for systems that are connected continously with intermitent disconnects. And most critically replication can work only over static names. Laptops connecting from various hot-spots and ISPs have a nasty habit of changing FQ names with each connection. Replication can overcome this only if a VPN of sort is used and VPN is usually a major support issue. Replication is just not designed for the high mobility of OCA systems.
Synch Framework will pretty much force you to SQL 2008 back end because of the need to Change Data Capture or Change Tracking, both being SQL 2008 only features.
You will still have plenty of hard problems to solve ahead (authentication, versioning and upgrade, data conflict resolution policies, securing data on the client for accidental media loss etc etc)
Personally, I would say:
.NET 3.5
WCF Data Services (for communication between the client app and your data)
SQL Server 2k5/2k8 (whichever you can use)
Silverlight w/ Out of Browser Functionality
VistaDB (to store data locally on the client until you can push to the server)
use unique-identifier for key if you are creating stuff while offline and not connected and when you do connect, updating the database.
this is going to be way easier than using auto-increment key
Having worked on an occasionally connected application, I'd encourage you to look in to SQL Server CE for the client machines, with Sync Services to handle the connections. Here is a good tutorial.
You could create this stuff from the ground up, it seems.
However, this seems an awful lot like a CRM application, and it wouldn't surprise me if you could find an enterprise software package to do this without starting from scratch and instead modify one of the configurations to meet your business rules.
In a previous life, I was a configuration developer for this thing called Siebel that might be close to what your'e looking for. They even have a built-in synchronization tool called Siebel Remote.
It might be a cheaper route to go than rolling your own from scratch.
I wrote an order taking program for wine sales reps. Here is the video. The client software is installed using click-once. That also installs SQL Server Express and loads the database. I used the Microsoft Sync Framework to sync the local database with the one on the server (see the last section of the video.)
With powerful clients now I don't see any reason to not use SQL Server Express, it is free with a limit of 4GB.
SQL CE had too many limitations - no stored procs being a major one.
You will need to use GUIDs everywhere as the primary key - see the new NewSequentialID().
I love click-once, it is a big time saver.
I'm looking forward to Silverlight, but just haven't had time to look into it. Not sure if I would have done it with Silverlight if doing it now or not.
Having said all this, this is not a project for anyone inexperienced. So I would also get some very experienced help.