Friday, March 27, 2015

Installing Solr 4.6 on Windows

The steps below are a guide to help you install Solr versions 4.1 to 4.6.  Here, I tested Solr 4.6 installation on Windows 7 and Windows 8.1.


1. Download and install Java SDK (I installed jdk-7u45-windows-x64.exe).

raghu1

2. Download and install Apache Tomcat (I installed apache-tomcat-8.0.0-RC5.exe). Usually, Tomcat is installed on port 8983 (but this is optional- you can specify your own port).

raghu2

3. Test the Tomcat server in your browser. You should see the following screen:

raghu3

4. You can configure the Tomcat server by going to Windows > Start > Monitor Tomcat

raghu4

5. Stop the Tomcat server by going to Windows > Start > Monitor Tomcat > General Tab> Stop

raghu5

6. Download Solr-4.6.0 and unzip it in your local directory i.e. C:\ Solr-4.6.0 (download zip file).
7. Go to downloaded Solr folder above (step 6) and Copy solr.war file to Apache webapps folder. I.e. Copy C:\solr-4.6.0\dist\solr-4.6.0.war file  to  C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps folder (rename solr-4.6.0.war to solr.war).
8. Create an empty Solr home folder. i.e. C:\solr
9. Go to downloaded Solr folder above (step 6). Copy all files from C:\solr-4.6.0\solr-4.6.0\example\solr folder to C:\solr (Solr home folder). This will be your Solr home folder.
10. Look into C:\solr and you will see two folders with name collection1 and bin.
11. Copy the jars from C:\solr-4.6.0\example\lib\ext (all jars) into C:\Program Files\Apache Software Foundation\Tomcat 8.0\lib (this is your Tomcat server main library directory).
12. Set the Java system property solr.solr.home to your Solr Home. Go to Windows > Start > Monitor Tomcat > Java Tab > Java Options. Enter the following entry at the end (see below screenshot): -Dsolr.solr.home=c:\solr


raghu11

13. Restart Tomcat by going to Windows > Start > Monitor Tomcat > General Tab > Start

raghustart

14. Test Solr by going to http://localhost:8983/solr/ in your browser. You should see the Solr admin page below.

raghu8

Source: http://blog.navigationarts.com/installing-solr-4-6-on-windows/

Wednesday, March 11, 2015

w2ui (New JavaScript UI Library)

w2ui (New JavaScript UI Library)

Popups and Overlays and many more

Popups and overlays are popular UI elements of modern web applications. If used right, it can significantly enhance user interaction, provide clearity and improve navigation of your application. The w2ui library has both popups and overlays. A popup blocks the content of the application for the duration of user interaction. An overlay, in turn, is non-blocking UI solutions that displays additional information. 
 

Saturday, March 7, 2015

Thursday, February 26, 2015

Search Engines: Comparison between Solr and Sphinx

Similarities:
  1.     Both Solr and Sphinx satisfy all of your requirements. They’re fast and designed to index and search large bodies of data efficiently.
  2.     Both have a long list of high-traffic sites using them
  3.     Both offer commercial support. (Solr, Sphinx)
  4.     Both offer client API bindings for several platforms/languages (Sphinx, Solr)
  5.     Both can be distributed to increase speed and capacity (Sphinx, Solr)

Solr Advantages:
  1.     Solr, being an Apache project, is obviously Apache2-licensed. Sphinx is GPLv2. This means that if you ever need to embed or extend (not just “use”) Sphinx in a commercial application, you’ll have to buy a commercial license (rationale)
  2.     Solr is easily embeddable in Java applications.
  3.     Solr is built on top of Lucene, which is a proven technology over 8 years old with a huge user base (this is only a small part). Whenever Lucene gets a new feature or speedup, Solr gets it too. Many of the devs committing to Solr are also Lucene committers.
  4.      Solr can be integrated with Hadoop to build distributed applications
  5.     Solr can be integrated with Nutch to quickly build a fully-fledged web search engine with crawler.
  6.     Solr can index proprietary formats like Microsoft Word, PDF, etc. Sphinx can’t.
  7.     Solr comes with a spell-checker out of the box.
  8.     Solr comes with facet support out of the box. Faceting in Sphinx takes more work.
  9.     Sphinx doesn’t allow partial index updates for field data.
  10.     In Sphinx, all document ids must be unique unsigned non-zero integer numbers. Solr doesn’t even require an unique key for many operations, and unique keys can be either integers or strings.
  11.     Solr supports field collapsing (currently as an additional patch only) to avoid duplicating similar results. Sphinx doesn’t seem to provide any feature like this.
  12.     While Sphinx is designed to only retrieve document ids, in Solr you can directly get whole documents with pretty much any kind of data, making it more independent of any external data store and it saves the extra roundtrip.
  13.     Solr, except when used embedded, runs in a Java web container such as Tomcat or Jetty, which require additional specific configuration and tuning (or you can use the included Jetty and just launch it with java -jar start.jar). Sphinx has no additional configuration.
Unless you need to extend the search functionality in any proprietary way, Sphinx is your best bet.

Sphinx Advantages:
  1.     Development and setup is faster
  2.     Much better (and faster) aggregation. This was the killer feature for us.
  3.     Not XML. This is what ultimately ruled out Solr for us. We had to return rather large result sets (think hundreds of results) and then aggregate them ourselves since Solr aggregation was lacking. The amount of time to serialize to and from XML just absolutely killed performance. For small results sets though, it was perfectly fine.
  4.     Best documentation I’ve seen in an open source app
  5.   Sphinx integrates more tightly with RDBMSs, especially MySQL
Source : http://stackoverflow.com/questions/1284083/choosing-a-stand-alone-full-text-search-server-sphinx-or-solr

Memcached Vs Redis, which one to pick for large web app?

Memcachedis a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source (such as a database or API) must be read.

Redis is a flexible, open source and advanced key-value store. It is referred to as a “data structure server” where keys can contain strings, lists, hashes, sets and sorted sets of strings.

The main differences between them are listed below:

Installation:
Comparing ease of Installation Redis is much easier. No dependencies required.

Memory Usage:
For simple key-value pairs memcached is more memory efficient than Redis. If you use Redis hashes, then Redis is more memory efficient.

Persistence:
If you are using Memcached then data is lost with a restart and rebuilding cache is a costly process. On the other hand, Redis can handle persistent data. By default, Redis syncs data to the disk at least every 2 seconds.

Replication:
Memcached does not supports replication. Whereas Redis supports master-slave replication. It allows slave Redis servers to be exact copies of master servers. Data from any Redis server can replicate to any number of slaves.

Storage type:
Memcached stores variables in it’s memory. It retrieve any information directly from the servers memory instead of hitting the database again. On the other hand, Redis is like a database that resides in memory. It executes (read and write) a key/value pair from its database to return the resultset and all data resides in memory.Developers are using Redis also for real-time metrics, analytics.

Read/Write Speed:
Memcached is very good to handle high traffic websites. It can read lots of information at a time and give you back at a great response time. Redis can also handle high traffic on read but also can handle heavy writes as well.

Data Structure:
Memcached uses string and integer as data structure. Everything you save can be either one or the other. With integer, the only data manipulation you can do is adding or subtracting them. If you need to save arrays or objects, you will have to serialize them first and then save them. To read them back, you will need to un-serialize.
In comparison Redis has a stronger data structures. It can handle not only strings, integer but also binary-safe strings, lists of binary-safe strings, sets of binary-safe strings and sorted sets.

Key Length:
Memcached key length has a maximum of 250 bytes, whereas Redis key length has a maximum of 2GB.


If you need advanced data structures or disk-backed persistence, you should look into Redis. On the other hand, you might want to stick to Memcached for its simplicity, reliability and speed.