Friday, April 14, 2017

Turbocharging SAP Hybris with SAP HANA


In my current work with Hybris, in most implemented solutions, scalability challenges come at persistent layers where there is a little say over data management (due to Item modelling created within the persistence layer in hybris) to normalize/optimize the database. To overcome it, I am currently trying to utilize SAP HANA, which is a relational database offering benefits of NoSql databases as well (as it is a RAM residing database which offers instantaneous data results akin to other OLAP offerings).

First, I sign up with SAP Cloud Platform which is currently offering a full scale HANA instance for 12 hrs (you would need to restart the instance). After this, I can create a database on the SAP Cloud Platform Cockpit as well as view my login credentials.





Next, I set that up on my local machine via eclipse. To use eclipse, one needs to install hana library (which I did via this update site : https://tools.hana.ondemand.com/neon on my Eclipse Neon).



Here I can see various infrastructure related things that can be modified to set the database level user management as well as utilize Hana for other things like predictive analysis, real-time machine learning from the available data, etc.





 
Now that our connection has succeded, we can create a little jdbc application to test the credentials that we used to confirm whether we can connect with the database. We will need to have the Hana java driver in the classpath to make this happen.



 

It is worth mentioning that as the database is tunneled via the Hana viewer, the host becomes localhost:30015 and the user name/password is the one that you have set for the database instance (not the S/P user ID that SAP gave you or the userd id of the SAP Hana Cloud instance)


After this, we can trivially set this up on Hybris via the following db configuration in local.properties:

db.url=jdbc:sap://localhost:30015/?reconnect=true
db.driver=com.sap.db.jdbc.Driver
db.username=
db.password=

Start the Hybris and initialize it (note the DB name in the following image)



After initialization, you can use Hybris as an e-Commerce/CRM solution and utilize HANA as its extremely fast and fault-tolerant backend system.
My experience was that it was not as blazingly fast as it is portrayed to be, but then I am just using a 2MbPS connection but YMMV.

What was your experience ? Do let me know in the comments below or shout out to me @sumitbbd your experiences.

Wednesday, January 18, 2017

JRebel alternatives for SAP Hybris

Developers hoping to accelerate their Hybris debugging time while skipping the time consuming steps of ant clean all - server start and then debugging can do so with DCEVM and change code on the fly basis and view it on the browser without having to restart hybris.

Advantages

  • Reduced time to carry out trivial changes.
  • Faster development cycle.
  • Flexibility in trying out features.
  • Increased server uptime.

Step-by-step guide

Login into help.hybris.com and view the following page for this:
https://help.hybris.com/6.2.0/hcd/0b40907d5db14955bf4074b4b25e6998.html

Although the steps are mentioned in the hybris help, this post is done to incorporate other changes that we faced here in Eperium.
  1. Download the light installer from https://github.com/dcevm/dcevm/releases
  2. Open cmd from start menu and right-click 'Run as Administrator' (as there are no sudo user console otherwise in Windows)
  3. cd to location where DCEVM jar is present and run java -jar DCEVM-light***-installer.jar 
  4. Run the install DCEVM as altjvm for your JDK
  5. If there is an permission error, you need to check if jar was run with admin privledges (see point #2 above)
  6. If there is an error 'could not get dceversion of ..' , then download a different version (try older and stable versions from step #1 above)
  7. Add the following to local.properties
tomcat.debugjavaoptions=-XXaltjvm=dcevm -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n



Do an ant to update configurations in the embedded tomcat server (used by Hybris) and run Hybris server in debug mode. Now connect Eclipse with it as remote process.

Thursday, December 29, 2016

Microservices as a Product

Now that the year is wrapping to an end, use of microservice architecture continue on the rise. However, people are often confused in understanding the use and more importantly, rational behind creation of these services which are not to be confused with API and providing versioning of them in silo-ed manner, but to ensure that all end consumers are accommodated by them.
In a recent technology radar, a term 'Microservice As A Product' was promoted, which prompted my introspection and in my opinion is misleading because when you market a product, there are a bunch of micro services that are documented and provided, and over time, these grow and parallel services provide an alternative - while the original ones remain for backward compatibility.
It is true that established players are promoting microservices in cloud and also provide a marketplace, but treating it as a product is a bit far fetched; as terming it as tooling (a software component) rather fits the job well. Otherwise, we are bound to be stuck with the naming conventions and keep getting confused (similar to an application and a plugin).

Tuesday, August 16, 2016

Migrating Hybris with Ease

Running Hybris On Oracle - and deriving advantages of its data backup/recovery mechanism.

During a common course of Hybris implementation, at times changes made (intentionally or otherwise) in the schema/data can adversely affect the development environment and make it unstable. In some cases, initialization of system is the only resort which means losing all the manually created configurations that are made in the system and re running the impex scripts (which are not hooked up for their automatic execution). However, this is time consuming as well as requires manual intervention if the impex scripts and external settings are not properly set. Similar in design of rails active record where the database state is kept in form of migrations, the data structure is kept under impex and items configuration and updated as necessary.

To alleviate this problem in our latest project, we are using the same oracle database that is present on the staging server and just after re-initialization, resetting the database back to its saved state.
Periodically, the database team resets the master db backup to keep up with the occurring schema changes (which ensures that the additional work that a developer has to perform after 'initializing' the system is kept to minimum). So instead of running all the impex and doing synchronization, only a typical system update suffices.

Here's a short description of how the database is reset from its backed up state.


1. Disconnect from all running applications/programs that oracle user is logged into.

2. Log on to SQLPLUS as admin user: sqlplus / as sysdba

3. Drop and Create the user via the sql file with the following text (the path where the dbf files are present inside the oradata folder).

CREATE TABLESPACE YHTSPACE DATAFILE 'G:\app\oracle\oradata\HYBRIS\YHSPACE.DBF' SIZE 20M AUTOEXTEND ON LOGGING;
CREATE TEMPORARY TABLESPACE YHTEMP TEMPFILE 'G:\app\oracle\oradata\HYBRIS\YHTEMP01.DBF' SIZE 5M AUTOEXTEND ON;
define us=aphy
define pw=aphy
define ts=YHTSPACE
define tts=YHTEMP
DROP USER &us cascade;
CREATE USER &us IDENTIFIED BY &pw DEFAULT TABLESPACE &ts TEMPORARY TABLESPACE &tts PROFILE DEFAULT ACCOUNT UNLOCK;
GRANT "CONNECT","RESOURCE","CTXAPP" TO &us;
GRANT UNLIMITED TABLESACE TO &us;
ALTER USER &us DEFAULT ROLE ALL;
GRANT CREATE CLUSTER TO &us;
GRANT CREATE DATABASE LINK TO &us;
GRANT CREATE SESSION TO &us;
GRANT create ANY INDEX TO &us;
GRANT CREATE SEQUENCE TO &us;
GRANT CREATE SYNONYM TO &us;
GRANT CREATE TABLE TO &us;
GRANT CREATE VIEW TO &us;P
GRANT CREATE PROCEDURE TO &us;
GRANT CREATE TRIGGER TO &us;
GRANT CREATE TYPE TO &us;
GRANT CREATE SNAPSHOT TO &us;
GRANT EXECUTE ON CTX_DDL TO &us;
GRANT ANALYZE ANY TO &us;
grant IMP_FULL_DATABASE to &us;


4. Run the import command:
imp aphy/aphy FROMUSER=APQA TOUSER=aphy file=G:\app\oracle\oradata\HQD_22072016.dmp


While this method of managing database is time saving, it inherits the problem found in most of the tailor made approaches which involve manual intervention. Whether this is a worthwhile approach or a poor one is totally up to you and can be used in a manner depending upon your needs.