Kayıtlar

RPC or REST; Which one is best suited for your Web API ?

When we design an api for our software components, then a couple of confusing terms are just at the front of us. Let's first cope with the conceptual confusion about the terms in this question. What is an API ? API is the acronym for the Application Programming Interface. It is a group of methods  that is exported by a provider software components/modules  and is supplied to its consumer software components/modules and the messages(XML, JSON, etc.) of these method calls are transported accross the client and server sides. Web API In the context of web, an API is refered as a group of methods that is the web protocol HTTP is used for the communication  by transferring the messages,  generally of the form; XML or JSON format. Okay then, if a consumer is using an API; then it is communicating via a service provider with dependency to a contract defined by the API over some communication protocols such as HTTP and exchanging the messages in a s...

Spring Boot with H2

In this tutorial, we will examine the usage of the in-memory database h2 in a Spring Boot application. H2 is an in-memory database, we can use it for simple case-studies and quick show cases. Maven Dependencies This can be easily generated with Spring Starter. The dependency for Spring Data and JPA: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> The dependency for H2: <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <scope>runtime</scope> </dependency> H2 Configuration Now, we can configure the database settings in application.properties file: spring.datasource.url=jdbc:h2:mem:testdb spring.datasource.driverClassName=org.h2.Driver spring.jpa.database-platform=org.hibernate.dialect.H2Dialect spring.datasource.username=sa spring.datasource.password=password spring.h2.console.enabled...

Load Balancer

Resim
Websites may be in need of serving millions of incoming requests from clients. This high traffic leads us to scale the web application horizontally by adding more servers to the server pool. At this point, the network traffic should be directed to the servers in a way of well-balanced and this is called load balancing . A load balancer makes this balanced distribution of network traffic across servers. A load balancer may be of the form of a physical hardware device or a software. Load balancers mainly enable horizontally scaling with which the following benefits are implicitly gained: minimizes server response time maximizes throughput prevents bottlenecks avoids single points of failure  Load balancing algorithms Round Robin In Round robin load balancing; the requests are distributed sequentially to the servers. Round robin load balancing is easy to implement however it has a drawback that long-running requests are not taken into account and this lea...

Proxy Server

Resim
There are two kinds of proxy servers; forward proxy and reverse proxy. Forward Proxy A forward proxy is also known as proxy server or web proxy. Proxy servers are located in front of clients and provides managed access to outside of the internal network. In a typical scenerio; A client wants to access a website on the internet and makes a request over proxy. Why doesnot the client access directly ? Because the client is prevented direct connection to the internet for security concerns. The proxy executes some logic on the request decides whether to forward or not. The proxy forwards the request to where it's routed. The server to which the request is sent does not know about the client, it knows the proxy as the sender. The server responds back to the proxy. And the proxy route the response to the client. Use cases Enforcing security policies on clients in the internal network. Blocking access to certain websites. A blocked-ip-ranged client for a websi...

Java EE Technology Stack

Resim
In this article, we will examine the components of Java EE technology stack and historically look at the new comer components and version changes in the components along with the Java EE versions. I will use this article as the umbrella for Java EE stack and update for every new features added to Java EE. About Java Enterprise Edition Under the container architecture named Java Enterprise Edition;   - business logic (projects to EJB)   - contents or presentations (projects to Servlet, JSP, JSF) are developed as software components and then run in a managed execution environment named containers. In terms of Java EE, there are two types of containers; Web container In web container, the components are generated in the form of Servlet, JSP and JSF, called web components. Tomcat is a Java EE web container in which web components can be executed. Application container In the application container, the components are generated in the form of EJBs. Weblogic, We...