Can you suggest that what are points to be considered while doing Performance Tuning in Java?

2014-03-05 06:30:01 阅读( 1 )

2104人 收藏本页

标签:Java面试题

* Keep an eye on Threads if you are into an Multi-Threaded application, never create threads at your will, Implement a Thread-Pool instead.
* Garbage Collector runs whenever Used Memory reaches Heap-size so you don have to worry about it, but do not try to call GC on your own it will produce system idle time. One GC call could eat up around 3 sec of your System Time.
* I/O operations as mentioned above, is very dangerous. Always keep checking them, use Buffered Streams than normal Streams.
* DB call is also an I/O operation. Write Strored Procedures to encapusulate almost all your DB related Business Logic and reduce Application Cycle between DB & your Objects for a Single Request.
* Create Appropriate Indexes for your Tables, this will reduce the time taken to Fetch the data fro the tables.
* Tune your SQL statements approp. for ex. select * from employee where citizenship = ‘indian’ and firstname = ‘david’
will outperform
select * from employee where firstname = ‘david’ and citizenship = ‘indian’
* Keep your object lifecycle clean, de-reference whenever you are done with a particular object. use static with caution will not only eat memory also will cause some funny sync. issues

来自IT公司面试手册

下一篇:What is the difference between Comparable and Comparator Interface?

上一篇:how is a singleton class different from declaring a class with all methods static

亲~ 如果您有更好的答案 可在评论区发表您独到的见解。

您想查看更多的信息: 面试题