×
Community Blog A Guide to Server Application Development

A Guide to Server Application Development

In this guide, you will learn to develop applications with kinds of servers and platforms like ECS, Node.

To start with the basics, one of the popular open-source JavaScript runtime environments is Node.js that is built on Chrome's V8 JavaScript engine. Node.js is mostly used for building server-side and networking applications. TCP (Transmission Control Protocol) is a networking protocol that enables reliable, ordered and error-checked delivery of a stream of data between applications. For both sides to exchange data streams, a TCP server must accept a TCP connection request, and the connection is then established .

We can write two types of TCP socket programs - server and client. The server's function is to listen for connections from the client and then send the processed data back. This communication happens via sockets.

The TCP Programming in node.js requires an internal module called net and it works as an asynchronous wrapper for network programming. net is an extensive module whereas for this tutorial, we'll only cover TCP Server and Client. We will be using Alibaba Cloud Elastic Compute Service (ECS) to build the Server and Client.

Getting Started

To follow this tutorial, you will need a machine running a linux/unix distribution such as ubuntu or macOS, a code editor/IDE node.js installed on it and a basic working knowledge of node.js. In this tutorial we won't be deploying the application for production but simply run it on our development machine and test it from there.

Creating a TCP Server

To begin, create a directory where you would like to store your application. For this tutorial, we will create our application in ~/nodejs-tcp-app.

In this tutorial, we will be doing most of our work with the terminal and also, use nano editor in the terminal ensuring the process remains the same for all the platforms.

To start, open your terminal:

mkdir ~/nodejs-tcp-app

Now, switch to the newly created directory and run npm init to create the package.json file.

jcd ~/nodejs-tcp-app && npm init

Now, the terminal will prompt for basic info about the project, so add the name, author and main file as server.js and create the file. You should see the package.json file in the directory now.

You can refer to Node.js TCP App Development on ECS,and get the following steps.

Related Blogs

Rapid Application Development with Yida

Learn how developing applications and websites just got that much easier with Alibaba's Yida platform.

The Apsara Conference, generally regarded as one of Alibaba's more programmer-oriented conferences, this year was held from September 25 to 27. During the three days of the conference, two forums and over 110 summits and tracks were held, revealing and showcasing some of Alibaba's newest, most cutting-edge technologies to the public.

What is Yida?

This year, one of the highlights of the conference was Yida. Yida is a platform and a tool to help you and other developers develop applications without the need to code. During the conference, there was a hands-on demonstration in which a lightweight approval chain application was developed. The whole development process happened to take only 30 seconds, and was a real eye-opener for both developers and other visitors at the conference.

Yida is a zero-code development platform that was incubated at Alibaba for more than two years. It provides a full-feature graphical interface on which you can edit and configure webpages, forms, and processes in an intuitive way. The interface also allow you to release applications directly on a computer or smart phone with only a few clicks. In other words, Yida provides a quick-and-easy way for you to develop applications and doesn't require that much technical knowledge.

The Whys and Hows of Yida

Consider this. On average, it would take two to three weeks to develop a typical reimbursement approval chain application by using traditional development models. However, Yida can cut down the time required to as little as just one hour. That goes without saying that the entire development cycle and even labor costs can be reduced significantly.

Why SSDs Matter for Application Development

The benefits of SSDs don't end with these use cases. SSDs can also speed the development of applications.

Solid state disks (SSDs) have become popular in consumer devices, and sometimes server environments, as a means of improving data I/O and application performance.

But the benefits of SSDs don't end with these use cases. SSDs can also significantly speed the development of applications. This article explains how software delivery teams can leverage SSD storage to improve application development.

SSDs Enable Frequent Builds

Modern DevOps teams work at a pace that more traditional teams would call frantic. Builds have become micro-sized and they're more frequent as team members commit code all through the day.

Docker containers enable teams to work in this manner—to decompose your application and develop it in a distributed way. At a time when application development is more complex and developers use multiple OSes to build development environments, containers bring consistency across the team. Containers also allow for portability of code, as the same container can be run in different environments and even in production.

In the past, the number of VMs were manageable and development environments were fewer and more consistent. Today, applications are more distributed and are developed over a large number of containers. Docker also enables greater variation in development environments and the explosion in the number of container instances used for development (and the small files inside each container) have a big impact on storage.

Dev teams need storage which can handle the high input/output operations per second (IOPS) that today's container-based operations require. This can be achieved to an extent by optimizing storage for containerized development, but to see big results, it takes a switch from traditional storage disks to cloud-based SSDs.

SSDs Better Align QA with Dev

With DevOps, testing has become more aligned with development and happens earlier in the development pipeline. Tests are equally fragmented to reflect the change in development. In addition, containers have made testing more consistent, as QA teams can test the exact same containers used in development environments. This means no more configuration drift and better team dynamics.

SSDs Help Create Environments Faster

The ability to quickly create new environments is a necessity. This is true for Dev as well as QA. They need to be able to easily and quickly create new dev and test environments to support the pace of work. Test environments need to be destroyed after test runs and results need to be stored persistently—and containers have made this possible. What it once took to spin up and fully configure a VM now takes mere seconds, thanks to Docker. Because they're much more lightweight than VMs, containers enable higher server density and require much less storage per instance.

To fully take advantage of the container revolution for Dev and QA, SSDs are a must-have. The high IOPS, throughput, and low latency that they enable give DevOps teams the confidence to move faster through each step of the pipeline. QA teams can push the limits when trying to break things in the apps they test, knowing that creating a new test environment takes just a few seconds.

Along with these fundamental changes at the infrastructure level, greater gains can be achieved with automation. When dev and test environments are created and destroyed automatically, it relieves DevOps teams of the burden of having to configure infrastructure from scratch every time—and this wouldn't even be possible to do manually, considering the scale at which modern DevOps teams function. Taking this into account, automation would be severely restricted if done using traditional hard disks. SSDs let you take advantage of the speed that automation provides when creating and destroying dev and QA environments.

It's the World's First Application Management Model, and It's Open-Source!

Alibaba and Microsoft have joined forces to try to make developing and managing cloud applications for developers just as easy as managing apps on your iPhone.

Jointly launched by Alibaba Cloud and Microsoft, Open Application Model (OAM) is the world's first project for defining cloud-native application standards and architecture modeling. Jiang Jiangwei, an Alibaba partner and the general manager of the Alibaba Cloud's smart infrastructure product division, made this announcement in Shanghai on October 17. The vision of OAM is to communicate and connect application developers, operators, and application infrastructure in a standardized approach, making cloud-native application management and delivery simpler and more efficient.

In the announcement, Jiang Jiangwei said: "OAM is the first project for cloud-native application standards and architecture modeling in the industry. With this architecture model, we hope to connect application developers, operators, and end users in an efficient way, allowing them to enjoy a seamless and easy application management experience."

At the same time, Redan Burns, a Distinguished Engineer at Microsoft and the founder of the Kubernetes project, also announced this important joint release on Microsoft's official website.

So, what is OAM? And what brought the world's two top technology companies together to want to take this project for defining application standard definitions and architecture modeling towards this direction? Well, the answer to this question can be traced back to the story of the earliest cloud application delivery in the world.

A Story of Cloud Application Delivery

On March 14, 2006, Amazon released the cloud storage service called Simple Storage Service (S3). Shortly after the service was released, a Microsoft technician developed an application by using this particular service as the underlying storage service.

According to the developer, "it took several days" from decision-making to writing, delivering, and running the application". He was very excited about this, and later wrote in his blog: "the S3 announcement was game changing." The developer's name was James Hamilton. He was an architect of IBM Db2 in earlier days, and he later became one of the leaders of Microsoft's SQL Server. And then, in just two years after developing this magic application, he moved to Amazon. Today, James Hamilton has become the vice president and a key figure at AWS.

From 2006 to now, cloud computing has undergone several waves of change. Today's cloud is no longer the strange thing that the public first saw 13 years ago, which needed to be "tried out". Rather, with the extreme optimization of cost and resource efficiency of cloud, today's cloud services have undergone changes so dramatic that Moore's law no longer applies.

Now, this timeline still continues. Not too long ago, in August 2019, Alibaba announced that "the next turning point of cloud computing has arrived." Migration to cloud is quickly becoming the default choice for enterprises that are planning their application architecture and infrastructure. In 2019, if a developer wants to launch a Java website on a cloud platform like James did in his era, what would the experience be like?

Related Products

Simple Application Server

A single server-based service for application deployment, security management, O&M monitoring, and more

Data transfer plan packaged with SSD cloud server, starting from $3.50 per month. Same price for renewals.

Simplifies Development

Provides a wide selection of popular images to choose from (WordPress, LAMP, etc.)

Elastic Compute Service

Elastic and secure virtual cloud servers to cater all your cloud hosting needs.

On top of the world-class customized components from our various vendors such as Intel, Alibaba Cloud invested heavily on the Research & Development of our ECS product. Over the time, we developed X-Dragon compute platform, including the self-developed SOC, hardware acceleration card, as well as the Dragonfly lightweight hypervisor.Our Technology leadership provides a foundation for the high performance, availability, elasticity, scalability and security you enjoyed in our ECS products.

Related Courses

How to Manage Ultra Large Application with EDAS

Manage Ultra-Large-Scale application has many challenges, such as application management and monitoring, high availability, performance optimization, and system expansion .etc. This course will show you how to manage the large applications on Alibaba Cloud using EDAS which is the core product supports 99 percent of Alibaba Cloud's large-scale application systems.

Alibaba Cloud DataWorks-Application Development

This course explains the development process of DataWorks, it explains in detail about data development, scheduling configuration, data management, operation & maintenance management and project management modules of DataWorks. Fully explained the functional application of DataWorks.

Related Documentation

Install and configure the develop environment

This topic describes how to install Ali-Tomcat and Pandora and how to configure the development environment for Eclipse and IntelliJ IDEA.

Install Ali-Tomcat and Pandora

Ali-Tomcat and Pandora are containers in which EDAS depends to run services. They integrate core features such as service publishing, service subscription, and trace query. Applications must be published to Ali-Tomcat and Pandora for running.

  1. Download the Ali-Tomcat package and decompress the downloaded package to a directory, such as d:worktomcat.
  2. Download the Pandora package and decompress the downloaded package to the deploy directory (d:worktomcatdeploy) where Ali-Tomcat is saved.
  3. View the Pandora directory structure.

In a Linux system, run the tree -L 2 deploy/ command in the relevant path to view the directory structure.

jd:\work\tomcat >  tree -L 2 deploy/
            deploy/
                └── taobao-hsf.sar
                    ├── META-INF
                    ├── lib
                    ├── log.properties
                    ├── plugins
                    ├── sharedlib
                    └── version.properties

In a Windows system, directly navigate to the target path to view the directory structure.

Configure the Eclipse development environment

To configure Eclipse, you must download the Tomcat4E plug-in and save it to the directory where Ali-TomcatPandora is stored. After the configuration is complete, you can directly publish and debug local code in Eclipse.

  1. Download the Tomcat4E plug-in
    The following figure shows the package content.Tomcat4E plug-in
  2. Open Eclipse. In the menu bar, choose Help > Install New Software.
  3. In the Install dialog box, click Add on the right of the Work with section. In the Add Repository dialog box, click Local. In the dialog box that appears, select the directory (d:worktomcat4e) where the downloaded Tomcat4E package is decompressed, and click OK.
  4. Return to the Install dialog box. Click Select All and then click Next.
    Complete subsequent steps as instructed. After installing the Tomcat4E plug-in, restart Eclipse to make Tomcat4E take effect.
  5. After Eclipse is restarted, choose Run As > Run Configurations from the Eclipse menu.
  6. In the left-side navigation pane, find AliTomcat Webapp and click New launch configuration in the upper part.
  7. On the page that appears, click the AliTomcat tab. In the taobao-hsf.sar Location section, click Browse. Select the local Pandora path, for example, d:worktomcatdeploytaobao-hsf.sar.
  8. Click Apply or Run.
    Next time, you can directly start this project without the need to configure it again.
  9. View the output information about project operation. If the following Pandora container information appears, the Eclipse development environment is configured.

Solidity Development Tool - Blockchain as a Service

The contract platform of Ant Blockchain supports Solidity smart contracts. In Cloud IDE, the development environment of Ant Blockchain, you can compile, deploy, test, and debug a smart contract.

This topic describes how to download, install, and use the Solidity compiler solc-js provided by Ant Blockchain. This topic also introduces the solc compiler.

Download solc-js

Click here to obtain the installation package: alipay-solc-0.1.10.tgz. The size of the package is about 1.76 MB.

Notes:

  1. Ant Blockchain does not support the native Solidity language. You can only use the compiler solc-js provided by BaaS.
  2. The compiler solc-js provided by BaaS is alipay-solc-0.1.10.tgz. It is compatible with Solidity syntax prior to version 0.4.24 (excluding version 0.4.24).

Install solc-js

Node.js is required when you install solc-js. Make sure you have installed Node.js before you install solc-js. The process is as follows:

  1. Download and install Node.js.
  2. Install solc-js globally. Run the following command in the directory where you downloaded alipay-solc-0.1.10.tgz:
jnpm i -g alipay-solc-0.1.10.tgz

Use solc-js

After you install solc-js globally, you can use this tool directly in the command line. You can use solcjs --help to view the parameters supported by this tool.

Related Market Products

Windows Server 2008 R2 with AMD GPU driver preinstalled

GPU cloud server is a computing service based on GPU application. It is applicable for AI deep learning, video processing, scientific computing, graphic visualization, and other application scenarios. Alibaba Cloud becomes the first cloud provider partnering with NGC GPU Container in China (which provides the best fully optimized deep learning framework for customers). The GPU cloud server GA1 instance uses AMD's S7150 series GPU. Alibaba Cloud and AMD optimized the AMD GPU driver together, and customers can use the OS image with the pre-installed AMD GPU driver from Alibaba Cloud Marketplace. They can quickly deploy their softwares with excellent ability of graphics rendering, computing and video processing.

LAMP Stack PHP 7

Classical web application environment with LAMP stack and the next generation of PHP version 7. It also includes Selfmanagement Preset, a self-management, self-monitoring and self-healing components and phpMyAdmin, a web interface tool for the administration of MySQL.

0 0 0
Share on

Alibaba Clouder

2,079 posts | 484 followers

You may also like

Comments