Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

We have a point-of-sale system that was developed using ado.net, our current concern is to make the application real fast in creating transactions (sales). Usually there are no performance concerns with high end PCs but with with low end PCs, the transactions take really slow.

The main concern is on saving transactions which usually calls a lot of stored procedures for inserting records within a single transaction. This usually takes time on low end PCs. We need to improve the performance since most clients will only use low end PCs to act as cashier machines. One solution we are thinking is to use entity framework for data access. The entire project is written using ado.net and development time if we shift to entity framework would be alot. Any suggestions?

share|improve this question
    
Are all those stored procedures etc. useful in any way at the moment the transaction is registered? Is it needed to get the receipt? If not: Can't you just move them to back-end processing? –  Luc Franken Jul 5 '13 at 15:09
    
Yes they are all needed for the receipt –  Gian Acuna Jul 5 '13 at 15:17
3  
Ok, so where did you measure the most delay? In the end it comes down to how much to process and the processing power so somewhere you should reduce the amount of work to be done or the amount of power to do the work. If all steps are really required when making the receipt then the only option is to benchmark and improve small parts. Though most of the time fast improvements can be made by removing steps (like lowering stock) to a later moment so it doesn't influence the user experience. –  Luc Franken Jul 5 '13 at 15:23
    
Okay thanks, I'll need to test some components aside the database connection –  Gian Acuna Jul 6 '13 at 0:49
    
If it's slow with ADO.Net, it's going to only be slower with EF. AS others have stated, EF is an abstraction on top of ADO.Net. The exception being if EF is writing better SQL than your current code. –  RyanJMcGowan Sep 1 '13 at 8:59

4 Answers 4

up vote 6 down vote accepted

I would like to point out that Entity Framework (full name: ADO.NET Entity Framework) is an ORM (Object Relational Mapper) that uses ADO.NET under the hood for connecting to the database. So the question "should we use ADO.NET or EF?" doesn't really make sense in that respect. Unless you re-architect your application, adding EF to the mix is simply adding another layer on top of ADO.NET.

I sincerely doubt that ADO.NET is the source of your performance problems, however. It sounds like the problem exists in your stored procedures themselves.

I think Luc Franken's comments are on the right track, though. You need to measure and determine exactly where the delays are happening. Then concentrate on fixing exactly that problem. Anything else is groping around in the dark.

share|improve this answer
    
you're right. I'll need to run more tests in other areas than the database matters –  Gian Acuna Jul 6 '13 at 0:53

If you are looking for performance stay away from EF. It is the slowest ORM out there and uses a lot of memory to keep the database metadata. Most benchmarks out there show that -

share|improve this answer
    
Would you suggest we keep the ado.net data classes? –  Gian Acuna Jul 5 '13 at 15:18
    
If by ado.net data classes you mean DataTables and such, I don't think so. These are the most bloated classes I know. If performance is your problem I would start looking at microOrms such as Dapper that runs this very site. –  Otávio Décio Jul 5 '13 at 15:29
4  
While I have no objection to stating that "EF is slower than ADO.NET", I disagree with absolute statements like "slowest ORM out there". Consider this benchmark which shows roughly equivalent performance, and this one which shows why there might be different results in different benchmarks. It very much depends on what the test consists of. –  Bobson Jul 5 '13 at 17:49
1  
ADO.Net is abstracted by EF. I doubt EF is the "slowest out there" because there's too many factors such as what type of query is being called and how well an ORM can bundle a database query into one call. The consensus I've been witnessing in a rather lengthy LinkedIn discussion is to just use your favorite ORM, test it, find the queries that are unacceptably slow and optimize just those queries with better ORM calls or replace those methods with ADO.Net. –  RyanJMcGowan Sep 1 '13 at 8:42

You say you are calling a "lot of stored procedures". If every call includes a seperate trip to the database, that is your performance issue, because trips to the database are always expensive, no matter what they do. You should have one stored procedure to save a transaction. If that procedure has to call other procedures, fine, as long as you don't have to make a seperate trip to the database.

share|improve this answer
    
No, we only have one connection to the database and all stored procedure calls use this connection. We have different stored procs because we save in a lot of tables. –  Gian Acuna Jul 6 '13 at 0:46
1  
I could be wrong, but I don't think opening and closing the connection is the only expensive part of running a stored proc. I do know for sure that there is no limit of one table update per stored proc. You might try just combining two of those and doing some before and after profiling. –  KennyZ Jul 8 '13 at 13:12

How necessary is it that each transaction require a database call?

At what point is the db insertion being performed? Is there one call per transaction or is it inserting with every addition to the order causing a major lag throughout the user's interaction?

Can the db call be handled through private HTTP requests to a dedicated server on the client's own LAN?

Perhaps a better approach would be to save the transactions in a repository and post them to the server all at once using the Unit of Work pattern that is triggered as soon as there is a pause of more than 5 seconds. Or perhaps the slow client machines could post to a service that can handle the database insertions.

What else could be slowing the machine? Is the GUI processor intensive? It's a POS, not a graphic designer's portfolio piece.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.