Entries Tagged 'Java' ↓

Response to Web Application: To Couple or Not to Couple?

I just read this thread on The Server Side and it makes me nervous that people still ask this kind of question. The thread starts off by asking “An usually annoying question when designing an action-based web application is: “Should I place everything in my action or should I separate the web logic from the business logic?” and the alarm bells in my head are going off already. Continue reading →

Boston Scalability User Group

I’ve been digging around lately for a Boston area user group dedicated to architectural scalability and I haven’t been able to find one. Other user groups that I regularly attend have meetings centered around scalability once in a while, but I’m looking for something with a schedule dedicated to the topic. It’s a hot topic in the industry right now with a lot happening on different fronts and there should be some ongoing professional discussion dedicated what goes into growing an application.

Here are some of the topics I want to talk about:

  • Data growth and access - What kind of DBMS topologies allow maximum scalability without breaking the budget? What if the budget wasn’t a problem? How do you migrate your data model from hundreds of users to millions of users? Should you partition user data across shards or keep it in a central database? How do you profile data access paterns? Is your application mostly-read or mostly-write? When should you use an LDAP directory for data storage? When should you use MySQL and when should you use Oracle?
  • Application server scaling - app server clustering, web server integration, load balancing, application session management, data caching
  • Web Tier - load balancing reverse proxies, data caching, working with HTTP, considerations for exposing functionality via REST
  • Language conisderations and platform choices - Dynamic languages vs. Static languages, Linux vs. Windows, Solaris vs. Linux, RedHat vs. Oracle, IBM vs. Oracle - How do you make these choices? What evaluation critera are most important? Which ones are misleading?
  • Framework scalability - How can you scale if your framework can’t? Does Rails really scale better than Spring Web MVC? Where do PHP frameworks fit in? What are the alternatives? This is where we will investigate what you gain and lose by binding yourself to a particular framework, how to keep the coupling to a minimum and how to use your framework as a solid foundation instead viewing it as a cage.
  • Emerging technology - Should you become familiar with Map Reduce and Hadoop? What kind of impact do object databases have on your application? Should you buy your own Sun or Dell boxes or use Amazon’s EC2 and S3?
  • Application architecture - How do you write an application that scales? What does your application look like as it grows from servicing hundreds to millions of users? How does it handle session management? How does it access datastores? Are there any design patterns that are helpful? What are the anti-patterns to be aware of?

Like I said, I haven’t found a group dedicated to discussing these topics. If you know of one in the Boston area please let me know. Assuming there isn’t one I am willing to start one. I’d like to start off small and meet at coffee shops around Burlington or Lowell. I have no delusions that this is going to start off or even become as big as NEJUG is now. If it starts off as a few people getting together to talk about scalability trends, cool caching solutions and specific products then I’d call it a good start.

The meeting location is still TBD and will be based on how many people are interested in attending. It will probably be somewhere in Burlington, MA. There is no planned presentation at this time. Instead we will have a meet and greet and then discuss scalability trends and news, what approaches to scalability are commonly used now and what are the plans for the future.

If you are interested in coming or in finding out more information please email me at <my first name>@<my domain name>.<my tld> or leave a comment below. Please make sure to include your email address when you fill out the form so that I can get in touch with you - your email address will not be displayed on my site.

RE: Generics Microbenchmark

After the popularity of my “How’d this String get into my List<Integer>?!” post I decided to follow up with a few small benchmarks. I got the idea from Geoffrey Wiseman who read my previous post and wondered about Generics performance. Continue reading →

How’d this String get into my List<Integer>?!

I was having a discussion with some co-workers at the No Fluff Just Stuff conference this weekend about Java and incorrect types getting put into generic collection classes. Generics were introduced in Java 5 in 2004 to add a compile time type safety to allow a type or method to perform operations on objects of various uniform or related types. The discussion we had focused on the fact that generics do not accomplish what the language specification says they will accomplish by allowing objects of a different type into a generic object. Continue reading →

Solution for ClassNotFoundException with JUnit and Ant

Last time I sat down to work on a new build.xml file I ran into a ClassNotFoundException while trying to run my JUnit tests. It turns out that a few other people have experienced the same problem, too. None of the pages I found from Google had a solution posted so I will post the solution I came up with. The problem that I am trying to solve is:

Testsuite: net.anthonychaves.test.geoip.locator.LocatorServiceTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 3.634 sec

Testcase: testGetLocation took 3.622 sec
Caused an ERROR
net/anthonychaves/geoip/locator/LocatorService
java.lang.NoClassDefFoundError: net/anthonychaves/geoip/locator/LocatorService
at net.anthonychaves.test.geoip.locator.LocatorServiceTest.setUp(Unknown Source)
at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

The first thing I did was fire up Ant with the -debug flag so I could examine the classpath carefully. My *Test.class files were definitely in the classpath passed to the forked JVM but they were not found. Because I was using a forked JVM and doing so erases a lot of useful information I set fork=”no” and ran it again. This time I got:

Finding class net.anthonychaves.test.geoip.locator.LocatorServiceTest
Ignoring Exception java.util.zip.ZipException: error in opening zip file reading resource net/anthonychaves/test/geoip/locator/LocatorServiceTest.class from /home/anthony/workspace/IPAddressLocatorClient/build/classes/net/anthonychaves/test/geoip/locator/LocatorHelpersTest.class

The good news is that this is a message that I did not get while running the test in a forked JVM. The better news is I had a good idea what the exception means. Apparently Ant expects all the classes to be in Jar files rather than in directories on the file system. A few tweaks to my build.xml file and it looked like this: build.xml

Now I’m creating two jar files, one for the application and one for the unit tests. After the unit test jar is created I run them in the JUnit task after setting the classpath with the test jar file. I would have liked to put off creating the application jar file until I knew the JUnit tests passed but that is not an option at this point. I don’t feel strongly enough to make it an option either. I have a 2.4 GHz Pentium 4 computer, I can afford to make a few extra jar files.

When debugging Ant build problems run with the -debug flag and turn off JVM forking if possible. If I didn’t do those two things I would still be debugging.