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

Wednesday, December 26, 2007

Sourcesafe Hackability

Peace be upon you,
Today I am going to hence about something that is critically dangerous, it's SourceSafe, I recommend to read the coming paragraph it will save lot of explanation


"Quoted" - http://keir.net/vsscrack.html

Visual SourceSafe (VSS) has a very weak password management system. There is one file stored within the VSS directory structure on the VSS server called um.dat (usually in the data sub-directory). This file contains all user names together with a hash of their passwords. The hashing process is poorly designed and insecure, not just due to the size of the resultant hash (2 bytes!) but also due to the extremely simple algorithm used to generate it. Such is the weak nature of the hashing algorithm that there are literally hundreds of easily obtained passwords that result in the same hash as the real password. In other words, the hashing algorithm used is extremely prone to collisions. So just bear in mind -- the passwords that this program produces are not necessarily (and in fact are probably NOT) the actual passwords initially created by the user, but will still give you the same level of access to VSS as if you had used the same original password. As an example, using a largish word list, my own password hash produced nearly 600 equivalent matching passwords, none of which was the true original but any of them could have been used in place of it.

Now after you read that, it is matter of minutes to crack the toughest password in SourceSafe, I just want to draw your attention that there is lots of other tools that work as source control with more safety and flexibility also it's open source which means you can develop your own version of source control with custom security you made or install from anywhere as plug-in, By the way, threre is HELL of tools that crack SourceSafe Password, also there is no way to secure it, as long as user has access to the Password file, it is done, anyways here is some recommendation for source control application that can be used to protect our code,

http://en.wikipedia.org/wiki/Concurrent_Versions_System
http://svnbook.red-bean.com/

Personal recommendation for client tools
CVS - http://www.tortoisecvs.org/
SVC - http://tortoisesvn.tigris.org/

Hope this article informative and helpful

P.S: there is many tools around I didn't want put any of it, to avoid anything that may cause trubles

BR
Ahmed Essam

Some way to hack GSM Networks

Peace be upon you

how are you guys? I will just hint for this thing, it's small device for GSM software developers, this device is used to test the application that is on the SIM Card that is provided by GSM Network provider, here is link for the device I am talking about it, it's Called detective,
http://www.gemalto.com/products/detective/
I hope to get one :D, I don't think that it is available to anyone to buy it.
I am not saying go hack GSM networks, this things is very simple I am just telling that there is device monitor the commands that is going out and coming in, :D I am not saying more :D

Thanks for your time

BR
Ahmed Essam