Posts

Showing posts from 2016

12 Factor App

Introduction In the modern era, software is commonly delivered as a service: called  web apps , or  software-as-a-service . The twelve-factor app is a methodology for building software-as-a-service apps that: Use  declarative  formats for setup automation, to minimize time and cost for new developers joining the project; Have a  clean contract  with the underlying operating system, offering  maximum portability  between execution environments; Are suitable for  deployment  on modern  cloud platforms , obviating the need for servers and systems administration; Minimize divergence  between development and production, enabling  continuous deployment  for maximum agility; And can  scale up  without significant changes to tooling, architecture, or development practices. The twelve-factor methodology can be applied to apps written in any programming language, and which use any combination of backing services (database, queue, memory cache, etc). I. Codebase One codebase tr

Elasticsearch Indexing Performance Cheatsheet

You plan to index large amounts of data in Elasticsearch? Or you are already trying to do so but it turns out that throughput is too low? Here is a collection of tips and ideas to increase indexing throughput with Elasticsearch. Some of them I have successfully tried myself, others I have only read about and found them reasonable. In any case, I hope you will find them useful. General Performance Before doing anything more specific, it makes sense to follow the advice given in the Elasticsearch documentation on  configuration . In a nutshell: Set the maximum number of open file descriptors for the user running Elasticsearch to at least 32k or 64k. If possible, consider disabling swapping for the Elasticsearch process memory. Note, however, that in a virtualized environment this may not behave as expected. Set -Xms to the same value as -Xmx (the same result can be achieved by setting the ES_HEAP_SIZE environment variable). Leave some amount of physical memory unassigned so t

ANTI-IF

Image
Here’s a little story... about a developer working in a software company who was building up a nice platform. One day the boss calls the developer on the phone and says: "There’s a new task I need you to do for a really important client, and it must be done by the end of the day. All that’s needed," the boss continues "is to add a small piece of functionality to that class method you’ve been working on... it shouldn’t be too complex..." The days  go by... and that small class, edit by edit, grows into a small code monster: the more you feed it with IFs, the bigger it grows! Do you think it’s just a fairy tale? Well, it’s not! What follows below is a single class method taken from real code that is live on a server somewhere on the Internet right now. And this is just a "baby monster". The more you feed it, the bigger it grows! How to join the  Campaign public ArrayList eseguiAnalisi() { ArrayList listaSegnalazioni = new ArrayLi

Hibernate MSSQL Server dialect mapping for N* JDBC types

You have to extend the dialect, and register the appropriate Hibernate types for the N* JDBC types, in the constructor. public class MyDialect extends SomeOfTheProvidedDialects { public MyDialect () { registerHibernateType ( Types . NCHAR , StandardBasicTypes . CHARACTER . getName ()); registerHibernateType ( Types . NCHAR , 1 , StandardBasicTypes . CHARACTER . getName ()); registerHibernateType ( Types . NCHAR , 255 , StandardBasicTypes . STRING . getName ()); registerHibernateType ( Types . NVARCHAR , StandardBasicTypes . STRING . getName ()); registerHibernateType ( Types . LONGNVARCHAR , StandardBasicTypes . TEXT . getName ()); registerHibernateType ( Types . NCLOB , StandardBasicTypes . CLOB . getName ()); } } Reference : http://stackoverflow.com/questions/27039300/jpa-sql-server-no-dialect-mapping-for-jdbc-type-9