Java


Bit of an exciting week for me. Last Friday a long contract finally came to an end and since I had six weeks notice of it I had signed up for the “Open Data 18 hour Challenge” on 4th and 5th July which from the blurb on their website was about local government data sets which have recently started to be released in Ireland. I was expecting something like the tech conferences I have attended in the past – some presentations, discussions maybe the odd coding and brain storming sessions; But boy was I wrong. If I had known what it was to be about before hand I would probably never have signed up for the challenge, but I am SO GLAD that I did. In short the challenge was to generate business idea’s that used open data and maybe in the future take them forward to a product and a new High-Tech business.

The challenge was run over two days when on the first day was almost a pure brainstorming session where you as part of a table of techies, academics, entrepreneurs you came up with as many idea’s as you could on using the open data sets (Fingal County Council datasets and Dublin dataset ) Each table had to create two or three posters from the best ideas they could come up with – and there were loads. Once the posters were created and everyone had a look at them there was a short presentation on each one of them after which everyone voted on which ones were the best idea’s. Once all the votes were cast the idea’s with the least votes were eliminated and then we were asked to pin our names to the projects we wanted to do the next day – I chose one called “BizFit”. We were then told at the end of the next each of the ten teams had to do a five minute “Dragon’s den” style presentation to a panel of judges who would make the the final choices.

The BizFit idea is conceptually a simple one in that the idea is to use demographic data to either allow a small-to-medium company to find the best location for their business or for someone like an estate agent find the best kind of company for a particular empty business unit. With a great team of six people we had to develop the idea, discover the competitors and work out revenue streams etc for the final slide based presentation.

Anyway to cut a long story short our BizFit team beat off stiff competition to win the £4000 euro prize. Needless to say our team were stunned at our success.

Not too sure what we are going to do next. There is talk about entering the launchpad process to see if we can take the idea further. I hope we do since its an interesting business idea.

If you want more information on the challenge and the results from the Fingal Open Data Site, New Tech Post, Silicon Republic and Digital Times

I learn’t a lot on the process of business idea generation and what is needed to initiate the process of turning an idea into something more concrete. The “buzz” in the air on both days was palpable and I got to meet a lot of great people whom I hope to maintain contact with.

I am working on a project, and am spending a fair bit of time trying to get the Java Virtual Machine to perform better. This is very much a black art and in reality there is not much out there in the ether to look at. I did however find this excellent page on the JVM Parameters you can use which provides much more information that “java -help” which only lists the basics.
The only downside is I would like to more information on what a load of the parameters do…. Anyway hope you find this useful.

If like me you are a java developer on unix this little blog might be of some use if you have lots of jars and are prone to “which jar contains the class X” where X could be riomhaire.roster.model.User and you find your self in a long search. What I do is ….

Have a file in my home directory called “classlist.txt” which contains the output of “jar -t” after some text replacements to remove non classes and to replace “/” with “.” so we can get the class names correct. Each jar dump includes the jar name and location.

The script is fairly simple being :

#####################################################################
echo “##### ${1} ####”
jar -tf ${1} | sed ’s/\//./g’ | grep “\.class$”
echo “”
#####################################################################
and which I call ‘listJarClasses’

I invoke the script via the shell command line:

find / -name “*\.jar” -exec listJarClasses {} >>classLocations.txt \;

at the end I end up with a file which can look like:

##### ./ant/etc/ant-bootstrap.jar ####
org.apache.tools.ant.Main.class

##### ./ant/lib/ant-antlr.jar ####
org.apache.tools.ant.taskdefs.optional.ANTLR.class
##### ./ant/lib/ant-apache-bcel.jar ####
org.apache.tools.ant.filters.util.JavaClassHelper.class
org.apache.tools.ant.util.depend.bcel.AncestorAnalyzer.class
org.apache.tools.ant.util.depend.bcel.DependencyVisitor.class
org.apache.tools.ant.util.depend.bcel.FullAnalyzer.class

……

Then if I want to find a class I open the file and search for the class name I am looking for and look for the preceeding jar name.
Hope this is of some use.

In my last piece about instrumentation I (hopefully) showed the importance of instrumenting your code – in many ways it is one of the major “unwritten� requirements in any project – along with a good logging strategy. The tough question is what do you instrument and what are the options?

As with most things in development there are many options and variants – you just need to choose what feels right for your project. A passionate and professional developer after a few years in the minefield of software development gets to know what will and more importantly what will not work in a situations.

Ninety percent of software development involves something (user/software) invoking a method or command on some target object. Some of the things you can track from that is:

  1. How long the invocation took.

  2. The result of the invocation (success, error etc).

  3. The average time invocation of this method/command.

  4. The maximum time of any invocation.

  5. The minimum time of any invocation.

  6. The invocation/min/max/average times for 1-5 for the last n commands.

  7. Values 1-5 but broken down by success/error etc – can help if “success� times take a lot longer than the errors.

  8. How much memory was used.

  9. How many times method/command has run.

  10. Tallies on errors.

  11. Deviation counters – How many times <1 second, <10 second, <100 sec, <1000 sec and so on. For All/success/error etc.

  12. Tallies by hour, day, week, month etc.

  13. Throughput calculation by the second, minute,hour,day depending on the domain.

  14. Error rates by second, minute,hour,day depending on the domain.

  15. Drop rates – in some systems requests can time out. You might need to track these.

  16. Uptime.

  17. Load – number of concurrent invocations etc.

  18. Memory usage (very very rough in Java).

  19. Data transfer – if you can calculate request and response sizes.

This list is by no means complete, and if you have any suggestions then drop me a line at gary(at)garyleeson.com.

You can also from the above work out what invocations were executing concurrently which can help in figuring out the hog processes when certain “odd� things occur that depend on when and what things are running; For example when two processes use a lock to access some resource. When run individually everything runs fine. When they run concurrently one gets the lock and the other has to wait; if the process that has to wait has a hard time constraint then you might have issues.

Another thing to do is make sure that all this is kept as an in-memory database for performance reasons – using a traditional DB backend such as postgres could have quite an impact; this does not prevent you from building in a mechanism to flush to backing store during quiet periods or every 5 minutes or so.

<meta name="GENERATOR" content="OpenOffice.org 2.0-pre (Linux)" /><meta name="AUTHOR" content="Gary Leeson" /><meta name="CREATED" content="20060903;21231800" /><meta name="CHANGEDBY" content="Gary Leeson" /><meta name="CHANGED" content="20060903;22120900" /><br /> <style> <!-- @page { size: 21cm 29.7cm; margin: 2cm } P { margin-bottom: 0.21cm } --> </style> </p> <p style="margin-bottom: 0cm">Do you know how well your application functions? Can you tell me what is the average time for a request to be handled? the worst? Can you tell me how your application functions with time? If not then you have missed one of the most common “unwrittenâ€? requirements – that of instrumenting your code.</p> <p style="margin-bottom: 0cm"> <p style="margin-bottom: 0cm">Hang-on I hear you say!! you can profile the application and unit tests can give you this information. Yes this may be true, but it is never a substitute for building into your code instrumentation as you go along. You will never know when it will come handy, and anyway testing your code on your development machine is rarely anything like running it on the real deployment environment.</p> <p style="margin-bottom: 0cm"> <p style="margin-bottom: 0cm">For example, many years ago I developed some middle-ware for a large and very profitable international corporation. The piece of code was to mediate between the front-end and the back-end billing/resource system. Development went well and as usual I inserted instrumentation as I went along before the product was released into the production environment under the watchful eye of application management group. To help roll out the product there was a massive marketing campaign – TV, billboards the whole nine yards; first time I have ever seem anything I developed up on TV.</p> <p style="margin-bottom: 0cm"> <p style="margin-bottom: 0cm">About a month latter my line manager (a really nice lady) came to me and said “Gary there seems to be a problem with the system; I have just had my arse kicked by sales and marketing. The product is a great success but there are a lot of unhappy customers who get ‘time out’ errors from the GUI, and the GUI guys say its because the connection to your middle ware is timing out, and the applications support environment says the 3 machines in the deployment cluster are fine. Could you investigate and get back to me?â€? Sound familiar? Talk about a bombshell and a potential career limiting move. With the manager there I said “lets look at the instrumentation and performance screensâ€?; A couple of minutes latter the situation came clear. Two of the three machines in the middle-ware cluster were “downâ€? for the times and periods mentioned but for different reasons; one machine was “upâ€? and running but there were no performance metrics; the other machine was not up at all!!! So in effect we were running at 1/3<sup>rd</sup> capacity – no wonder we had problems. We paid a quick visit to application support. To cut a long story short, it turned out the machine which was down was “being upgradedâ€? – why that was done in the “busy periodâ€? and why it took a week would be another article; the machine that was “upâ€? but had no statistics turned out not to be included in the cluster configuration at all!!!</p> <p style="margin-bottom: 0cm"> <p style="margin-bottom: 0cm">These were soon fixed and everything went smoothly – especially when I wrote a script to monitor the scripts and analyze the results. So my manager would then know on a day/week/month basis how many actual transactions went through the system, how long they took, what the system throughput was and what we were capable of supporting, when the transactions took place. As a result my manager did not need to ask sales and marketing how many sales went through, and did not need to access application support unless from the statistics she was told one or more of the servers was down – where upon, she went looking for application support.</p> <p style="margin-bottom: 0cm"> <p style="margin-bottom: 0cm">I suppose the moral of this little story is if you don’t instrument your code you will never know you have a problem until someone with more power and clout than you comes looking for you with a big club embedded with nails and a very bad attitude.</p> <p style="margin-bottom: 0cm"> <p style="margin-bottom: 0cm">In the next blog I will go through the types of instrumentation and performance metrics are useful to put in your code.</p> <p style="margin-bottom: 0cm"> <p style="margin-bottom: 0cm"> <p style="margin-bottom: 0cm"> <p style="margin-bottom: 0cm"><!--86fcc9be86da0c6bc50d3b0f1e4167c7--></p> <div class="post-info"> </div> <div class="postmeta"> <p>Tags: </p> </div> <!-- <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"> <rdf:Description rdf:about="http://www.garyleeson.com/index.php/2006/09/03/instrument-your-code-young-man-and-do-it-now-part-1/" dc:identifier="http://www.garyleeson.com/index.php/2006/09/03/instrument-your-code-young-man-and-do-it-now-part-1/" dc:title="Instrument your code young man…. and do it now (Part 1)" trackback:ping="http://www.garyleeson.com/index.php/2006/09/03/instrument-your-code-young-man-and-do-it-now-part-1/trackback/" /> </rdf:RDF> --> <div class="post-footer"> </div> </div> </div> <p class="center"><a href="page/2/index.html" >Next Page »</a></p> </div> <div id="sidebar"> <ul> <li id="calendar"> <table id="wp-calendar" summary="Calendar"> <caption>March 2015</caption> <thead> <tr> <th abbr="Monday" scope="col" title="Monday">M</th> <th abbr="Tuesday" scope="col" title="Tuesday">T</th> <th abbr="Wednesday" scope="col" title="Wednesday">W</th> <th abbr="Thursday" scope="col" title="Thursday">T</th> <th abbr="Friday" scope="col" title="Friday">F</th> <th abbr="Saturday" scope="col" title="Saturday">S</th> <th abbr="Sunday" scope="col" title="Sunday">S</th> </tr> </thead> <tfoot> <tr> <td abbr="February" colspan="3" id="prev"><a href="../../../2015/02/index.html" title="View posts for February 2015">« Feb</a></td> <td class="pad"> </td> <td colspan="3" id="next" class="pad"> </td> </tr> </tfoot> <tbody> <tr> <td colspan="6" class="pad"> </td><td>1</td> </tr> <tr> <td>2</td><td>3</td><td><a href="../../../2015/03/04/index.html" title="Maeve’s a “Hacker”">4</a></td><td>5</td><td>6</td><td>7</td><td>8</td> </tr> <tr> <td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td id="today">14</td><td>15</td> </tr> <tr> <td>16</td><td>17</td><td>18</td><td>19</td><td>20</td><td>21</td><td>22</td> </tr> <tr> <td>23</td><td>24</td><td>25</td><td>26</td><td>27</td><td>28</td><td>29</td> </tr> <tr> <td>30</td><td>31</td> <td class="pad" colspan="5"> </td> </tr> </tbody> </table> </li> <li id="recent-posts-3" class="widget widget_recent_entries"> <h2>Recent Posts</h2><ul><li> <ul> <li><a href="../../../2015/03/04/maeves-a-hacker/index.html" title="Maeve’s a “Hacker”">Maeve’s a “Hacker” </a></li> <li><a href="../../../2015/02/21/action-maeve/index.html" title="Action Maeve">Action Maeve </a></li> <li><a href="../../../2015/02/14/valentines-meal/index.html" title="Valentines Meal">Valentines Meal </a></li> <li><a href="../../../2014/10/10/excitement-and-car-crashes-in-donabate/index.html" title="Excitement and car crashes in Donabate">Excitement and car crashes in Donabate </a></li> <li><a href="../../../2014/10/09/love-can-be-a-surprising-thing/index.html" title="Love can be a surprising thing">Love can be a surprising thing </a></li> </ul> </li></ul></li> <li id="search"> <h2><label for="s">Search:</label></h2> <ul> <li> <form id="searchform" method="get" action="http://www.garyleeson.com/index.php/category/tech/java/"> <div style="text-align:center"> <p><input type="text" name="s" id="s" size="15" /></p> <p><input type="submit" name="submit" value="Search" /></p> </div> </form> </li> </ul> </li> <li id="meta-4" class="widget widget_meta"><h2>Meta</h2><ul><li> <ul> <li><a href="../../../../wp-login.html">Log in</a></li> <li><a href="../../../feed/index.html" title="Syndicate this site using RSS 2.0">Entries <abbr title="Really Simple Syndication">RSS</abbr></a></li> <li><a href="../../../comments/feed/index.html" title="The latest comments to all posts in RSS">Comments <abbr title="Really Simple Syndication">RSS</abbr></a></li> <li><a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform.">WordPress.org</a></li> </ul> </li></ul></li><li id="twitter-1" class="widget widget_twitter"><h2><a href="http://twitter.com/garyleeson" class="twitter_title_link">Twitter</a></h2><ul><li><ul class="twitter"><li>No public Twitter messages.</li></ul></li></ul></li> </ul> </div> <div id="footer"> <p><small> <a href="../../../../index.html" title="Gremlin’s Fireside Chat">Gremlin’s Fireside Chat</a> is powered by <a href="http://wordpress.org/" title="Powered by WordPress 2.8, state-of-the-art semantic personal publishing platform">WordPress 2.8</a> and delivered to you in 1.538 seconds using 26 queries. <br /> Theme: <a href="http://ajaydsouza.com/wordpress/wpthemes/connections-reloaded/" title="Powered by Connections Reloaded">Connections Reloaded v2.1</a> by <a href="http://ajaydsouza.com/" title="Visit Ajay's Blog">Ajay D'Souza</a>. Derived from <a href="http://vanillamist.com/blog/" title="Connections Theme">Connections</a>. </small></p> <script src="http://stats.wordpress.com/e-201511.js" type="text/javascript"></script> <script type="text/javascript"> st_go({blog:'14205214',v:'ext',post:'0'}); var load_cmc = function(){linktracker_init(14205214,0,2);}; if ( typeof addLoadEvent != 'undefined' ) addLoadEvent(load_cmc); else load_cmc(); </script> </div> <!-- End id="footer" --> </div> <!-- End id="main" --> </div> <!-- End id="rap" --> </body> <!-- Mirrored from www.garyleeson.com/index.php/category/tech/java/ by HTTrack Website Copier/3.x [XR&CO'2013], Sat, 14 Mar 2015 18:35:59 GMT --> </html>