Performance Issues in Real-time data visualization application - c#

Here's the scenario:
I'm working on decision-support system which is being developed as windows forms client and MySQL database server. There are sources which update data in real-time in the MySQL database and my application is supposed to read and refresh the latest data every second and present them to user in graphically rich forms of presentations like graphs, bars, grids etc.
Now, we are facing problems and have performance bottlenecks. We found reading directly from database is a main problem and we want to boost this transaction. I came across memcached but I'm not sure if I can use this in this scenario. Can you please help me in removing this bottleneck? Can memcahced be used in this scenario? What are the different alternatives that can come to help in this situation?
Preferably, I would want to perform everything in memory and keep taking the database snapshots every 15 minutes to the disk. Is there a way I can do this?

Related

MySQL synchronization between 2 databases

I have a desktop Application which needs to be on an online database to sync between different devices. The problem is that the connection with the server 'in my case I use JawsDB free plan on Heroku' is very slow and takes a lot of time to load the initial data.
What I thought to do is to make an offline replica of the database and sync it from time to time when the user wants to sync with the online data. I did some research and I think using master-slave servers is the solution I'm looking for but for most of what I found the master was the online database.
I don't know much about databases but I think the master in my case is the Offline Database.
I'll appreciate if someone can tell me if it's the right solution for my problem and how to start implementing it (I'll be thankful if you can tell me how to implement a sync job that runs from code 'I'm using C#') or of course if there's another solution that should be implemented in my case.

How can I expand my program to make it used on multiple devices and give them access to the old database without losing data?

I built a software for a farm using C#, the program was meant to keep track of the inventory and the financial exchanges related to the farms work.
The software was built to be installed on the manager's computer who then entered the farms data and retrieved reports and so. While the accountant used the same PC to use the financial part of the program with a different account.
Now the farm's business grew and more users need to use the system, can I move the database with the old data to a server so users can log in the system from different PC's at the time and continue the old tasks?
If I can - what do I change in my code?
P.S. the database was done in MS Access.
Not a lot of information to go on here. I can tell you that Access is a file based database system, and so whilst you could put the database files on a server or a NAS device with no problem with multiple users you should expect to run into the usual problems of Windows file sharing - VERY SLOW performance as a minimum.
It is also possible that the database may have been limited to a single user at a time, and without any more information impossible to know whether the developers have allowed for multi-user at all or whether you could have a situation where if several people do open the file at once one person may be overwriting another's data leading to corruption.
The short answer is that if the original developers are no longer around and you cannot ask the question of them then you probably need a new dedicated application to do the work which would mean either a complete rewrite or an alternative commercial application.
For multi-user Microsoft SQL Server, MySql, or even Firebird or another dedicated database back end would be the way to go. The front end could be anything - Winforms, WPF, even a web application if that is what you want, but it would have to be written.
I hope that this is helpful.

Single Database and Many Users Desktop Application

I am new to this concept so i need guidance that what will be best to use in following scenario.
I have to make a desktop application that contains many features like parts Stock ,Employees Data,Company Cars Data etc etc.
now the problem is that many users would be using the application and offices situated are in different cities in which this application is installed.
I want a scheme that if one uploads any data to database other gets its reflection and other instantly gets updated.for example if more cars are added everyone using gets their cars list updated.
I was having idea to use webservices and data should be stored somewhere on website database so that everyone's application refreshes lists every say 20 seconds or so.
Any help is appreciated
You wouldn't reload all your data constantly; there are a couple of common approaches here:
keep a list of changes; if you add new data you add the primary data record and you write the fact that the change happened (essentially an "events" list). Then you can query the change log periodically to get and additions/updates/deletes simply by asking for all events after (x)
if the infrastructure allows, some kind of pub/sub framework - same approach really but typically using middleware for the changes, rather than the main DB
re how you get the data; polling is simple and effective; active pushing is harder to setup but may reduce latency - not sure it is worth it here
Another approach, though, is to design it as a web app - then all your data lives at the server-farm and is trivial to update immediately. Your "desktop" app could be a web page using ajax
Try Cloud Computing and store your data into cloud
OK trying to recover my points here after the downvote.
The cloud (windows Azure especially) is a great fit for this project. Web services would help too as they can be easily scaled out to a number of webservers (Instances in Azure speak). Having many desktop clients talking directly to a database is not a good idea and often results in scalability issues.
Output cacheing could help a great deal here if you are refreshing your client side data frequently, this can be implemented with almost no code. This makes it much easier to do than managing lists of changes.

WPF app - recommended approach for persisting this type of data...

What would you recommended re an approach to persist data for the following situation:
WPF application (desktop)
Will be capturing information ever second (approx) and will need to store about 5 values per second effectively.
Will need to save data for up to say 1 month
Usage will be both (a) real time viewing of last few hours data, + (b) ability to view historic view of data for other data, kind of like an ad hoc query to view the data. There would need to be some limited filtering or querying on the data store (whatever it is) prior to it being presented
What approach would be recommended here, ideally that is easiest and keep the WPF installation simple?
You could do it using the new SQL CE of Microsoft (which allows multithread). It's easy to deploy (I think it's just a matter of including a DLL)...
http://en.wikipedia.org/wiki/SQL_Server_Compact
It should handle the load fine, assuming not a gezillion people will be using it on the same machine. Even then it would be fairly easy to upgrade.
So you would run a timer or something to push your data mining into it every 5 seconds, then the client polls as the user loads screens in the client.
Later, you might want to separate it into two apps, one for the data mining, maybe running as a service and the other one as 'the client'. In that case having a server dedicated to the data mining would help.

Sync data between a windows desktop app and windows mobile client app

I need to knock up a very quick prototype/proof of concept application to demo to someone within the next couple of days so I've minimal time to research this as fully as I normally would. The set-up is a very simple database application running on a laptop - will only ever be a single user updating a couple of tables so I was thinking of knocking up a basic Win Forms app against SQL Compact. Visual Studio's auto generated data grid edit screens will be fine with a little customisation. The second aspect is to then add a windows mobile client application that can pull data from both tables stored on the laptop, edit some data and insert some extra rows before sending the changes back to the laptop copy of the database.
I've not done any WinMo development so what's the best approach for me to look at. Is it easy enough to sync data between the two databases when the WinMo device is connected to the laptop with USB?
Most of the samples I've looked at so far seem to be syncing SQL Compact with SQL Standard using IIS which seems a bit overkill. The volumes of data to be synced are so small that I can easily write some manual sync code if it's easy for me to query/update the Compact DB from the laptop application when the device is connected.
Edit:
I've seen mention that a quick and easy solution is to use RAPI - when the device is connected copy the DB to the laptop, connect and do the necessary magic and then copy it back to the device. Any problems with this approach? This is a single laptop user with a single mobile device user to sync up so it's pretty basic stuff. In any single sync the volume of updates is likely to be less than 10 records.
Take a look at Microsoft's Sync Framework. The have examples of synchronizing SQLCE as well as contact data. The Sync Developer Center page has loads of info as well.
Trying to do this manually is not fun. It sounds easy, but once you get into things like collision detection, precedence, transactions, guaranteed delivery and loads of other stuff you'll find it really isn't as straightforward as you might think.
EDIT
If your scenario really is as easy as you say (i.e. it's not really a sync, but a data copy) then yes, RAPI is probably the easiest mechanism if ActiveSync exists and is acceptable as part of the solution. It's nice because you don't have to write the transport infrastructure, and if what's in the box in't enough, you can always write custom RAPI extensions.

Categories