katratxo on Software Development

tail -f /var/log/brain | grep -i software

Posts Tagged ‘html5

Wow! 2 billion order lines per year, really? How much of that data can be stored offline?

with 2 comments

My colleague Antonio explained in his post the performance of the server side component in the Openbravo solution for Retail. Now let’s take a look on the client side part, What happens when you’re selling and your network goes down? How much time can you work in offline mode?

Imagine you have a store in Pamplona’s city center, and during San Fermín festival you sell all the required clothing for the festival: White shirt and pants, the red handkerchief and belts, bota bags, etc.

Now imagine you’re on July 5th, the day before the Chupinazo, your store is crowded by foreigners trying to buy the outfit and equipment for the festival; you have a lot of them in the queue waiting to pay. Everything is going so well, you’re selling a lot, but suddenly your network goes down, your internet connection is lost, you’re in panic!!, you start asking yourself: “Am I able to keep selling without internet connection?”Of course! You’re using Openbravo Web POS.

Remember what Antonio mentioned:

The POS terminals can work in two different modes: online mode, and offline mode. When they are online, and a sales order is created, the terminal sends this order to the Openbravo instance … If the terminal is offline, however, the order cannot be immediately sent. In this case, the order is stored in a database inside the POS terminal. Once the terminal returns to online mode, the POS terminal sends a batch which contains all stored orders to the Openbravo instance.

This is a nice feature but: How many order can I process in offline mode? How much time do I have before my POS terminal gets full?

The answer is: It depends on the processing rate (orders per minute) and the average order size (lines per order) of your store.

Let’s take the best scenario for your Pamplona store on July 5th as example. Let’s imagine that you’re are able to process 4 orders with 10 lines each every 60 seconds. That is, with a single POS terminal, you’re selling to 4 different customers every minute, without stopping a second. (This is almost physically impossible, but during Sanfermines you never know).

Some numbers (the geeky stuff)

An order with 10 lines is 3 KB of data in the POS terminal cache. If you are serving 4 customers each minute with a single POS terminal; you’re generating 720 KB per hour (nice speed). Notice that this is an ideal situation: 4 customers with 10 different products every minute without stopping.

At this frenetic rate, in a 12 hour shift without internet connection, and just before the party starts, you have stored 8.44 MB of data in your POS terminal offline cache.

While you were selling at the rate of 4 orders per minute, your colleague have called the Internet provider and reported the network problem. 12 hours later and just before closing the day, the internet connection has been restored and the terminal has sent all the 2880 orders that you have produced during the offline period.

The best thing is that you have provided all the required equipment to almost three thousand foreigners eager for party.

Don’t worry, the only limit is the physical space in your mobile device

If you are using an Android device like a Samsung Galaxy Tab 10.1 or a fully fledged Windows 7 tablet like the Asus Eee Slate EP121, your database will silently grow, allowing you to keep selling in offline mode.

At the rate of 4 orders per minute, it will take you more than 2 years to fill 10GB on your Samsung Galaxy Tab, or more than 4 years to fill 25GB on your Asus Eee Slate EP121, and remember, selling without stopping a second!!

The iPad limits

Unfortunately the previous statement is not true for the Safari browser on iOS. The Apple guys have set a 50MB limit for offline storage, but this quota is more than enough space for the normal operation of Openbravo Web POS with a very high order processing rate.

Openbravo Web POS supports enormously high processing rate

Under normal operation (online mode) every order is sent to the server immediately just after closing it. Openbravo Web POS allows you to work in offline mode but this is a fall back mode.

There are several benefits of immediately sending the orders to the server:

  1. Updated warehouse stock
  2. Generate a Sales Invoice when you specify it
  3. Any other retail related process you have implemented in your Openbravo instance

Working in offline mode shouldn’t be your normal operation mode, but even in some unusual situations where you have 1-2 days or even a week without network connection, Openbravo Web POS will support your operation without any issue.

What about Master Data?

When you login into an Openbravo Web POS terminal the required master data it is also stored in the offline cache. By master data I mean: Products (with images), Prices, Business Partners, Tax Rates, etc.

Caching master data will take space from your offline cache, but it is required to be able to have a fully working offline mode. In another post I’ll give you more detailed description of how much the master data takes in the database, but to give you a rough estimation: caching 1000 products with images and prices is about 22 MB of data. Remember the only device that enforces the 50MB quota is the iPad, on Android and Windows devices, the database will grow silently.

Conclusions

  • Openbravo Web POS supports high activity rate even without connection to the server
  • The number of orders you can process in offline mode depends on your selling rate (number of orders per minute) and the order size (average number of lines per order)
  • If you have a constant selling rate of 4 orders per minute (very unlikely), in 12 hours of offline mode you have produced 2880 orders and only filled the 17% of the initial database size
  • The only limit is your device storage space on Android and Windows devices. The database will grow silently if you reach the initial 50MB size. It will take you more than 2 years in the Samsung Galaxy Tab and more than 4 in the Windows 7 device
  • On the iPad you have a fixed quota of 50MB but you’ll have to remain selling for 3 days in offline mode (at constant rate of 4 orders per minute) to fill the database
  • If you think you’ll have huge amount of master data (products, business partners, etc) and long offline periods, you must use an Android or Windows device
  • Offline mode is an exceptional fall back mode, it shouldn’t be your normal operation mode. In online mode, every closed order is sent to the server immediately. The server will process that order and update stock and execute any other retail related process

I hope this post can clarify the most common question we often get about offline operation of Openbravo Web POS. As mentioned before, I’ll write another post more technical on master data cache.

.

Written by katratxo

July 16, 2012 at 6:18 pm

Choosing a HTML5 framework for Openbravo Mobile

with 6 comments

Openbravo 3 is a great product built on top of SmartClient library. SmartClient is a great framework that provides a set of UI components for building enterprise size, data driven applications, but it targets desktop browsers and is not well suited for mobile devices. You could make it work on a tablet device with some simplification of the UI you’re building, but when it comes to a smartphone, is way too heavy.

One of the key projects of Openbravo in 2012, is the support for mobile devices. In the last few weeks I’ve been doing some research on the available frameworks for mobile web development.

You can make a list of available HTML5 frameworks from developer community driven sites like Stack Overflow
or Hacker News:

We can complete the previous list with other libraries targeting mobile devices like:

Splitting the list in two groups

The list of available frameworks can be divided in two groups based on their approach to solve the problem:

  1. You need to generate HTML code and the library is just an abstraction on top of the DOM that helps you with the user interaction (gestures, tapping, etc)
  2. You rely and “talk” JavaScript then the framework takes care of generating the necessary HTML code for building the UI component, plus helping with the user interaction (capturing events, etc)

From our experience in building Openbravo 3, the latter approach is preferred. It’s easier to write something like isc.Window.create({width: 600, height: 400}); than building the tree structure of DIVs for building a window, apply CSS styles and then test in the different supported browsers.

I went through the list of available frameworks. For example, jQuery Mobile takes the first approach. You need to create HTML tags and annotate them with some attributes like data-role in a list.

On the other hand, with Sencha Touch you “talk JavaScript” and the library takes care of building the UI component. Unfortunately Sencha Touch is released under GPLv3 license and is not compatible with Openbravo Public License (OBPL), so Sencha Touch is not an option.

For the same licensing reason Kendo UI and DHTMLX Touch discarded too.

Other libraries

There are other interesting libraries like Bakbone.js or Ember.js.

Backbone.js “gives structure to web applications” and is usually used with jQuery or Zepto, and Ember.js (previously SproutCore 2.0) aims to eliminate “boilerplate and provides a standard application architecture”. A comparison between the two libraries can be found on Backbone and Ember

Other Approaches

There are other attempts to use Google Web Toolkit combined with PhoneGap to build mobile applications. You can check the Webcast made by O’Reilly Creating Mobile Apps with GWT and PhoneGap.

Conclusion

We haven’t decided yet which framework we’ll use, but we prefer to use a library that will help us eliminating the need of generating HTML code.

We are still iterating over the available choices, but probably we’ll make a decision in a few weeks.

If you have experience in mobile web development and want to give us a hint, we’ll love to hear from you. Drop us a line in our Open Discussion forum thread.

Written by katratxo

February 17, 2012 at 4:53 pm

Posted in Openbravo

Tagged with , , ,

Follow

Get every new post delivered to your Inbox.