Search This Blog

Sunday, January 20, 2008

Performance presentation

Peace be upon you
today I am gonna show you something I hope that you like, I have moved to new company, in my last day I have done something to my colleagues at GET Group, by the way I was working there in project called "E-Purse" I really learnt a lot there, it was good, anyways what I have done to my colleagues was this presneation it is about preformance I hope that you like it, you may find a lot of mistakes in it :D, I wrote very late and it took me to stay to 3:30 AM to write it here it is.




Performance Analysis and enhancement
Software Performance issues
Performance analysis tools
Performance recommendation



Agenda

•Introduction
•Primitive performance tips
•Performance Issues:
–Web Application
–Desktop Application
•Performance Analysis tools



Performance and cost

•Performance enhancing is very resources consuming
•Developer should be aware of performance issues and how does the machine work, to produce reliable code.
•There is a rule that says, “you can’t have optimum available performance as long as you didn’t plane for that from the beginning”.
•In performance enhancement focus on what can be achieved and don’t get disturbed with the optimum.
•Performance tuning is endless, as much as you invest time on it as much you get better ideas about enhancing performance



Tuning levels and targets


•High:
–System level : improving application how it interact with the system
•Network traffic
•Disk performance
•Memory usage
–Application level: improving the algorithm
•Locks
•Heaps
•Threading algorithm
•API usage
–Computer architecture : improving how it works with the processor (loss the portability)



Memory Problems

•Memory Allocation and De-allocation.
–Any object you allocate you must de-allocate, there is many ideas about that “Smart pointers for examples”, for .NET you have to ensure that you are working correctly with the “Garbage collector”, the class you do must implement the “IDisposable” interface, in the areas that you want to be sure that GC works you have to use
–Using (Class object = new Class())
{
……
}
- Use GC.SuppressFinalize() ,Finalize() and destructors, don’t forget this things must be treaded carefully and wisely
•Memory fragmentation
–When you allocation and de-allocation memory with high rates, you cause memory fragmentation which means that your application cause of some kind of wholes in the memory, because system allocates heap as the application request this may cause application to crash



•Stack over flow.
–Be wise when doing recursive calls, this is main reason for the application to crash and cause of performance leak, there is other complicated way to do the task instead of recursive calls.
•Buffer over flow.
–You have to check every variable coming to your code, what ever the source of the input you have to check it and you have to be sure that the input is validate and match your use.
•which to use ( Virtual memory or heap ) : for .NET it is not issue anymore GC manage this issue, for C++ it is really big performance issue.



•Misaligned data: when you are working with some data structure you have to be sure that you are using or working with aligned data, misaligned data consume a lot of processor resources.
–Split loads and split stores
•This is like a big black whole that eats up your application performance
•Processors now get over it and handle this kind of problems “Misaligned data”, some doesn’t cover it, try it with Mobile application.



•SMID
–Single Instruction, Multiple Data
•SSE
–Streaming SIMD Extensions
•Hyper Threading
–One processor that is has the ability to use the unused resources as preparation for the next execution instauration
•Dual core
–One chip that has actually 2 processors, in labs they discover that putting 2 physical processor will increase the performance and will lower the power consumption, that’s why it became like a direction in manufacturing the processors
•Application with mobility
–What is your application behavior with computers that have batteries
–As long as your application consume a lot of processor performance as long as the processor consume the battery, so your application may cause a problem if its performance not enhanced



Over all application performance


•In general, when your application connects to database try to make it less touches.
–For example instead of executing 5 queries to do one task, try to enhance it to make it less count and less complexity, there is limitation with queries complexity
–Use indexes WISLY
–Fetch the data that is really needed, don’t get useless data, this is cost traffic.
–When you read from file from disk be wise with accessing file, each time you access the file it cost “Time”.
–Don’t bother user with interface complication because you want to have better performance.



Web Application performance


•Try as much as you can to make it less touches to the server
–Use the client side scripting, it really help a lot, to avoid round trips to the server, but don’t fully depend on it you may cause security bridge if you are over use it instead of server checks.
•Use AJAX it is really good because it save the traffic.
•Think about new way of handling data through web
–Check “Project Astoria”
http://blogs.msdn.com/astoriateam/
•It is new way to transfer data “PURE DATA” instead of mixed data and HTML (AJAX)



•Bewared of memory problems that we have mention before
•DO YOUR APPLICATION WELL THREADED
–Even when you run your application over Dual core or Hyper threading processor without good performance practice all that will seem to be nothing, because your application is single threaded or not well threaded.
–Hyper Threading and Dual core, is useful only with the good threaded application.














http://en.wikipedia.org/wiki/List_of_performance_analysis_tool
http://www.amd.com/us-en/Processors/DevelopWithAMD/0,,30_2252_869_3604,00.html
http://www.intel.com/cd/software/products/asmo-na/eng/vtune/239144.htm
http://www.ahmed-essam.com/2007/10/performance-tools-amd-vs-intel.html
http://ahmed-essam.com/2007/02/2_10.html
http://ahmed-essam.com/2007/02/1.html3


I hope you like it, thanks for your time.

BR
Ahmed Essam

No comments:

There was an error in this gadget