使用本地DB优化客户端服务器应用程序?

时间:2021-11-12 09:07:41

I've got a client/server application written in C# using WPF. The database on the server is getting quite large and the application has to load much of it's data (let's not debate that part of it...just trust me on that and take it for what it is). I could instead pull the data as needed on demand, however that creates performance issues due to the constant querying back and forth with the remote db.

我有一个使用WPF用C#编写的客户端/服务器应用程序。服务器上的数据库变得非常庞大,应用程序必须加载其中的大部分数据(我们不要讨论它的一部分......只要信任我并将其用于它的本质)。我可以根据需要根据需要提取数据,但由于不断使用远程数据库来回查询,因此会产生性能问题。

What would be great though, is if on application start I could pull down the data I need to the client and store it in a locally running database. The application then queries the local database, rather than the remote server database. In this way, the application keeps a low memory footprint, but still has quick access to the data since it's local.

但是,如果在应用程序启动时,我可以将需要的数据下载到客户端并将其存储在本地运行的数据库中。然后,应用程序查询本地数据库,而不是远程服务器数据库。通过这种方式,应用程序可以保持较低的内存占用,但仍然可以快速访问数据,因为它是本地的。

Is it possible to use SQL Server Express or LocalDB in this manner? i.e. letting them run on the client machines, and syncing with the server database on application start? If so, would this be a recommended or not-recommended use of them?

是否可以以这种方式使用SQL Server Express或LocalDB?即让它们在客户端计算机上运行,​​并在应用程序启动时与服务器数据库同步?如果是这样,这是推荐使用还是不推荐使用它们?

Thanks

3 个解决方案

#1


0  

Check out MS Sync Framework if you haven't already: http://msdn.microsoft.com/en-us/sync/bb736753.aspx There's a steep learning curve but it is designed for these kinds of scenarios.

如果你还没有,请查看MS Sync Framework:http://msdn.microsoft.com/en-us/sync/bb736753.aspx这是一个陡峭的学习曲线,但它是为这些场景设计的。

The app can pull down new/updated data to the local database on startup or whenever required. This is helpful for performance or when the network connection may be unstable.

应用程序可以在启动时或在需要时将新的/更新的数据下载到本地数据库。这有助于提高性能或网络连接可能不稳定。

#2


0  

Check out SQL Lite

查看SQL Lite

SQL LITE

SQL LITE Features

SQL LITE功能

#3


0  

Could you not think about this the other way around and rather than pushing additional concerns into your client just think about putting a thin layer in front of your database?

您是否可以不考虑另一种方式,而不是将其他问题推到客户端,只考虑在数据库前放置一个薄层?

If you were to use a thin NoSQL based layer (MongoDB or CouchDB being most popular) you could just cache your objects within there so the load is taken off your database and pushed onto the cache, you also then get the ability to scale your cache horizontally across other boxes if you wanted.

如果您要使用基于NoSQL的精简层(MongoDB或CouchDB最受欢迎),您可以在其中缓存对象,以便从数据库中取出负载并将其推送到缓存,然后您还可以扩展缓存如果你愿意,可以横向穿过其他盒子

I know this kinda goes against the "Using Local DB" part of your question, but I didn't want to ignore the fact that you could solve your problem without touching the client (maybe a few connection string changes but your models would stay the same).

我知道这有点违背了你的问题中的“使用本地数据库”部分,但我不想忽视这样一个事实:你可以在不触及客户端的情况下解决你的问题(可能是一些连接字符串更改,但你的模型会保留相同)。

#1


0  

Check out MS Sync Framework if you haven't already: http://msdn.microsoft.com/en-us/sync/bb736753.aspx There's a steep learning curve but it is designed for these kinds of scenarios.

如果你还没有,请查看MS Sync Framework:http://msdn.microsoft.com/en-us/sync/bb736753.aspx这是一个陡峭的学习曲线,但它是为这些场景设计的。

The app can pull down new/updated data to the local database on startup or whenever required. This is helpful for performance or when the network connection may be unstable.

应用程序可以在启动时或在需要时将新的/更新的数据下载到本地数据库。这有助于提高性能或网络连接可能不稳定。

#2


0  

Check out SQL Lite

查看SQL Lite

SQL LITE

SQL LITE Features

SQL LITE功能

#3


0  

Could you not think about this the other way around and rather than pushing additional concerns into your client just think about putting a thin layer in front of your database?

您是否可以不考虑另一种方式,而不是将其他问题推到客户端,只考虑在数据库前放置一个薄层?

If you were to use a thin NoSQL based layer (MongoDB or CouchDB being most popular) you could just cache your objects within there so the load is taken off your database and pushed onto the cache, you also then get the ability to scale your cache horizontally across other boxes if you wanted.

如果您要使用基于NoSQL的精简层(MongoDB或CouchDB最受欢迎),您可以在其中缓存对象,以便从数据库中取出负载并将其推送到缓存,然后您还可以扩展缓存如果你愿意,可以横向穿过其他盒子

I know this kinda goes against the "Using Local DB" part of your question, but I didn't want to ignore the fact that you could solve your problem without touching the client (maybe a few connection string changes but your models would stay the same).

我知道这有点违背了你的问题中的“使用本地数据库”部分,但我不想忽视这样一个事实:你可以在不触及客户端的情况下解决你的问题(可能是一些连接字符串更改,但你的模型会保留相同)。