A Technology Blog About Code Development, Architecture, Operating System, Hardware, Tips and Tutorials for Developers.

Friday, August 31, 2012

Some limitations Of DWR

4:10:00 PM Posted by Satish , , , , No comments

DWR is a great technology to add interactive AJAX calls to your application. The best thing about DWR is, it works with wide range of browsers and you don't need to bother about browser dependent code. While the run time DWR generate the intermediate java-script to call your server methods. But selecting DWR is a tricky task and you need to take care of the following aspects of your application. Recently I came across the following few thing..


  • I was trying point my javascript to a different apache server using RewriteRule in apache and tomcat or application server was still there in my local machine. But the DWR was not working.. May be there will be some configuration to make this happen.

  • Same way I pointed the application server to a different server using ProxyPass in apache. And the same thing happended to me. The DWR was not working. Basically I thing if you are using DWR, your javascript and the application should be hosted in the same server.

  • If you are using SOA(Service Oriented Architecture), then this a bad idea to use DWR, as you can not make cross context calls.

I am posting to get solution for all these problems if any.

Related Topics:

Thursday, August 30, 2012

Workspace in use or cannot be created - Eclipse

5:17:00 PM Posted by Satish , , , , , 1 comment

Eclipse is saying that the "Workspace in use or cannot be created"  in Ubuntu. I say ok, probably a lock file was left behind and so I do:

rm ~/workspace/.metadata/.lock

No error (so the file was left behind), yet the problem is not solved. I tried clearing out the workspace path. Same problem.

Googleing, I found this post, so I ran:

sudo gedit /usr/share/eclipse/configuration/.settings/org.eclipse.ui.ide.prefs

removed the RECENT_WORKSPACES line. It works now.

Reference:
http://abautu.blogspot.in/2009/05/eclipse-says-workspace-in-use-or-cannot.html

Touch pad is not working on Ubuntu 11.04

9:33:00 AM Posted by Satish , , , , 1 comment

Following is blog post with respect to the problem which I faced on my dell vostro laptop with Ubuntu 11.04. My mouse pad(Touch pad) was not working after login screen.

After some googling I found forum articles which describing same problem. Those peoples have different version of Ubuntu with different manufactures of laptop. But I didn't found an exact cause of this issue.

Anyways following is the solution,
Execute following command on terminal

gconftool-2 --set --type boolean /desktop/gnome/peripherals/touchpad/touchpad_enabled true

Reference:
http://blog.railsupgrade.com/2011/05/touch-pad-is-not-working-on-ubuntu-1104.html

Tuesday, August 14, 2012

SPEED UP WITH MEMCACHED

Is your website running into performance bottlenecks? Does the database or backend feel like a really expensive resource, even though you’ve got a huge cluster set up to improve parallel processing? Read on to find out why you should be including Memcached, in your SOA based application.



Caching is a concept that almost all developers use in some form or the other in their applications. It’s basically about storing a piece of information in memory so that it can be retrieved quickly. Caching is mostly used for data that is accessed repeatedly, so that instead of calculating/retrieving from the disk repeatedly, which takes time, we can instead directly look it up in the cache, which is much faster. Caches can be used at multiple places in the application stack, so you have quite a few options when it comes to choosing where to cache, what to cache and how to cache.

Here are some of the techniques on how and where you might like to cache data:

  • Browser caching: As Web developers might be aware, some data can be cached on the client-side in the browser, like images, etc., so that they are automatically used when repeated requests for that resource are made.
  • Server-side caching: Data or objects can alternatively be cached on the server-side itself. This can either be a local server cache, a centralised caching server or a distributed cache.
  • Local database query cache: A good database caches the database queries or data internally, so as to improve the speed of looking up data as well as the performance of the database.
You may choose to implement a cache in one way or another, or you might use a combination of more than one technique to cache different types of data at separate levels. But more importantly, it is helpful to know whether you even need caching in the particular application/use-case you are thinking about.

Most people, in the process of implementing a cache, actually lose out because it was wrongly implemented. So the cache ends up slowing down the application, instead of speeding it up. Getting fancy software with fancy features doesn’t always make sense, but using even the modest ones in the right way, does.

Why you need Memcached

This discussion assumes that you have set up a cluster, and you want to implement caching. In this case, what happens if you start caching on each node independently? You will see that some nodes face memory issues, while others have quite a bit of memory left. Moreover, most of the data stored in their individual caches is redundant.

This calls for a centralised caching mechanism that makes sense, such that the data being cached is evenly distributed and unique for the whole cluster. And memcached is the right thing to choose.

It provides a solution in which the available memory in the cache is the sum of that on all nodes on which the Memcached instance is running. So if, for example, you have 10 nodes, with each being allocated 1 GB of memory for caching, you get a total of 10 GB of cache available for the whole cluster. Here are some features in Memcached that might lure you into using it within the context of your application:

  • Easy scalability: This feature is applicable for almost any software with the tag of “distributed”, but still, it is worth noting that Memcached needs minimal configuration to add a new node, with almost no special interconnect requirements. Your available memory in the cache just increases on the fly.
  • Hidden complexity: Memcached hides beneath it all the complexity associated with storing/retrieving the data from the cache. All we need to provide is the key associated with the data. The whole task of determining which node to store the data on, or to retrieve it from, is done by the Memcached client itself.
  • Minimal impact of a node failure: Even if a particular Memcached node does fail, it has almost no impact on the overall cache other than reducing the available memory, and a minor increase in the number of cache misses.
  • Flexible architecture: Memcached does not impose a restriction on all nodes to have a uniform cache size. So, some of your nodes with less physical memory can be set up to contribute perhaps only 512 MB to the cluster, while others may have 2 GB of memory dedicated for the Memcached instance. Apart from this, you can even run more than one instance of Memcached on a single node.
  • Multiple clients available: Memcached has client APIs available for various languages like PHP, C++, Java, Python, Ruby, Perl, .NET, Erlang, ColdFusion and even more.
  • Cross-platform: Memcached is available for a wide variety of platforms including Linux, BSD and Windows.
  • Multi-fetch: With the help of this feature, we can request values for more than one key at once, instead of querying them in a loop, one by one, which takes a lot of network round-trips.
  • Constant time functions: It takes the same amount of time to perform an operation in memory, whether it is a single key or a hundred. This corresponds to the Multi-fetch feature discussed before.



Saturday, August 11, 2012

THIRD PARTY MEMORY VS JVM MEMORY

Advantages of JVM memory over third party memory:

  1. JVM memory is faster (no network).
  2. JVM memory won’t require serialization, you have Java objects available to you.


Advantages of third party memory over JVM memory:

  1. It can be accessed by more than one application server, so your cache will be shared among all your app servers.
  2. It can be accessed by a variety of different servers, so long as they all agree on the key scheme and the serialization.
  3. It will discard expired cache values, so you get time-based invalidation.

Most of the technology selectors use either Memcached or Redis and there are several open source APIs with several languages to work with.

Related Topics:
THIRD PARTY MEMORY VS JVM MEMORY
MULTICORE ARCHITECTURE AND SOA
MULTITHREADING AND MULTICORE CPU
JAVA CONCURRENCY - PERFORMANCE BOOST
Java 5 Executor Framework
Concurrency: Callable and Future