Development of Tracker : Tracker Production

in #eos6 years ago

eosBLACK_thumbnail_2000-1030_eng.jpg

Greetings from the eosBLACK Team!

This posting is the last part of the series on Tracker development.

We talked about the overall issues of EOSIO’s plugin development up until the last posting. This third and final posting of the series on Tracker development is about its production.

Plug-in Performance Must be Improved

The transaction volume is increasing on a daily basis amid the rise of DICE and other new casino games while about 28 million blocks have already been created. Under the current situation, it will take a lot of time to create new nodes, synchronize all blocks from the beginning, and save them in MySQL.

Next, there are a few factors that affect plug-in performance:

1.Network condition when synchronizing blocks in P2P

Receiving the blocks in P2P can slow down the synchronization depending on the network condition with the connected node. Although the synchronization of blocks from the start may overload the network, performing the hard replay by downloading the saved block log can save a lot of time. Note that Block Matrix, which is one of the BP, operates the site in which you can save and download the block log each day.
URL: https://eosnode.tools/blocks

2.DB Insert speed

A block includes multiple transactions while a transaction includes multiple actions, leading to processing one Insert query at a time being very time consuming. However, time can be greatly saved while the performance, enhanced, if the plug-in collects the records in bulk before inserting it into the database. Applying it in the hard replay mentioned in factor 1 above is a good tip.

3.Action trace data several times the number of blocks

As mentioned in factor 2 above, there were about 300 million actions and inline actions for up to 10 million blocks and has since been increasing in speed. (“We love BM” of blocktwitter has been a key factor in this growth.) The insert sequence is not important since the applied transaction event can process the action and inline action and uses the transaction id as the key. Therefore, creating multiple threads to process the applied transaction can increase the performance.

You can think of ways to enhance the performance by considering the above. Currently, as we speak, we are operating the node with completed total synchronization while continually considering the measures to reduce the time of synchronization. We welcome any developers with good ideas or measures for improvement on Github or their participation in the development process.

Github: https://github.com/eosBLACK/eosio_mysqldb_plugin

Tracker API Server Configuration

The main purpose of API server development is to minimize the risk of third-party developers freely logging in the DBMS. We will show you an example of API-server development to utilize the data saved through a plugin.

The configuration for the example development is described below:

  1. API Server Specification

OS: Ubuntu 18.04

Language: Javascript

Framework: node.js

DBMS: MySQL 5.7

The development for the internal use or web service can use any preferred development environment and can connect directly to the DBMS.

The data can be queried through the sole use of a command and parameter.

1.png

  1. Account Information

2.JPG

Tracker API Development

This example delivers the account name as a parameter and shows the account information and the 100 most recent actions.

The following diagram shows the ERD of the MySQL plug-in. Refer to the ERD for the data needed for your query.

3.png

The following example shows a simple web server using node.js.

4.JPG

The following example shows the node.js code for creating the database connection pool.

5.JPG

The following example shows the defining of the command and parameter.

6.JPG

The following example shows the retrieval and output of data.

7.JPG
8.JPG
9.JPG

The following example shows an example route code being written.

10.JPG

The following example shows the command running the test.

11.JPG

The above examples show the tracker API using the MySQL DB plug-in. Note that there are many ways to use the data saved in the RDBMS as mentioned above, and we recommend the full utilization of features to the developers.

Thank you

eosBLACK team

eosBLACK Contact:
eosBLACK Homepage
eosBLACK Koreos
eosBLACK Medium
eosBLACK steemit
eosBLACK Naver Blog
eosBLACK Facebook
eosBLACK twitter
eosBLACK Telegram(Korean)
eosBLACK Telegram(English)

White Paper (Chinese)
White Paper (Korean)
White Paper (English)