Chuyển đến nội dung chính

Bài đăng

Compare Message Queue vs Webservice

STT Web Service Message Queue Notes 1 If the server fails the client must take responsibility to handle the error.  If the server fails, the queue persist the message (optionally, even if the machine shutdown). + Some Message Queue: RabbitMQ, Beanstalkd, ActiveMQ, IBM MQ Series, Tuxedo. + Web service: Restful, SOAP Service. 2  When the server is working again the client is responsible of resending it.  When the server is working again, it receives the pending message. 3  If the server gives a response to the call and the client fails the operation is lost.  If the server gives a response to the call and the client fails, if the client didn't acknowledge the response the message is persisted. 4  You don't have contention, that is: if million of clients call a web service on one server in a second, most probably your server will go down.  You have contentio...

[Source tree] Fix lỗi "***please tell me who you are"

Vào  Repository -> Repository Settings --> Advanced. Sửa thông tin  "Use global user settings" 

[Android Studio] Add *.jar file into project

Bước 1 : Copy tất cả *.jar vào thư mục libs   Bước 2 : Tại khu vực Navigator, chọn view ở mode Project : Bước 3 : Click chuột phải vào file *.jar trong thực mục libs , chọn ' Add as library ' Bước 4 : Trong file build.gradle của ứng dụng, thêm dòng: compile fileTree( include : [ '*.jar' ], dir : 'libs' ) Bước 5 : Clean Project và Build ------------------------------------ Step 1: Put the *.jar (example:  gson-2.2.4.jar ) into the  libs  folder Step 2: Right click it and hit 'Add as library' Step 3: Ensure that  compile files('libs/gson-2.2.4.jar')  is in your  build.gradle  file (or  compile fileTree(dir: 'libs', include: '*.jar')  if you are using many jar files) Step 4 : Do a clean build (you can probably do this fine in Android Studio, but to make sure I navigated in a terminal to the root folder of my app and typed  gradlew clean . I'm on Mac OS X, the command might be different on your s...

[LB-HA] Configuration Load balancing and High available on HA PROXY tool

Install HAProxy Load Balancer on CentOS Understand about High Available (HA) and Load Balancing Configuring the load balancer Setting up HAProxy for load balancing is a quite straight forward process. Basically all you need to do is tell HAProxy what kind of connections it should be listening for and which servers it should relay the connections to. This is done by creating a configuration file  /etc/haproxy/haproxy.cfg  with the defining settings. You can read about the configuration options at  HAProxy documentation  if you wish to find out more. Open a .cfg file for edit for example using  vi  with the following command sudo vi /etc/haproxy/haproxy.cfg Add the following sections to the the file. Replace the   with what ever you want to call you servers on the statistics page and the  > with the private IPs for the servers you wish to direct the web traffic to. You can check the private IPs at your  UpCloud Co...

[LB-HA] Install HAProxy Load Balancer on CentOS

Load balancing is a common solution for distributing web applications horizontally across multiple hosts while providing the users a single point of access to the service. It aims to optimize resource usage, maximize throughput, minimize response time, and avoid overloading any single resource.  HAProxy  is one of the most popular opensource load balancing software, which also offers high availability and proxy functionality. It’s available for install on many Linux distributions as well as Solaris and FreeBSD. HAProxy is particularly suited for very high traffic websites, and is therefore often used to improve web service reliability and performance for multi-server configurations. This guide lays out the steps for setting up HAProxy as a load balancer on CentOS 7 to its own cloud host which then directs the traffic to your web servers. As a pre-requirement for following this guide, you’ll need to have a minimum of two servers with at...

[LB-HA] Understand about High Available (HA) and Load Balancing

High Available (HA) :  Hỗ trợ dự phòng tiến trình. Hoạt đông với cơ chế Active - Passive . Hệ thống tồn tại 02 loại Component với role 'Active' và 'Passive'.  Active   Component sẽ đảm nhận việc xử lý tiến trình. Passive Component đóng vai trò backup. Trường hợp Active Component gặp lỗi (fail, downtime) hệ thống sẽ chuyển sang hoạt động trên B ackup  Component . Quá trình chuyển từ Active Component sang Passive Component gọi là 'Fail over'. Một số khái niệm liên quan đến HA: - FailOver: Chuyển đổi tiến trình chạy trên Passive Component khi Active Component gặp sự cố. - Fail Back: Khôi phục lại tiến trình hoạt động trên Active Component sau khi tiến trình dịch chuyển đến Passive Component trong quá trình FailOver. - Fault - Tolerant: Công nghệ giúp đảm bảo tính liên tục của dịch vụ. Trường hợp một thành phần trong hệ thống bị hoạt động gián đoạn vẫn cho phép toàn bộ hệ thống hoạt động ổn định. Load Balancing : Hoạt động với cơ chế Active - Active ....

[Code Sample] Java Socket Connection

1. Server source import java.io.*; import java.net.*; public class Server { ServerSocket providerSocket ; Socket connection = null ; ObjectOutputStream out ; ObjectInputStream in ; String message ; Server() { } void run() { try { // 1. creating a server socket /* * port: the port number, or 0 to use a port number that is automatically allocated.  * backlog requested maximum length of the queue of incoming connections. */ providerSocket = new ServerSocket(2004, 10); // 2. Wait for connection System. out .println( "Waiting for connection" ); connection = providerSocket .accept(); System. out .println( "Connection received from " + connection .getInetAddress().getHostName()); // 3. get Input and Output streams out = new ObjectOutputStream( connection .getOutputStream()); out .flush(); in = new ObjectInputStream( connection .getInp...