CN111176654B - Internet of things application online compiling method based on multi-user cache - Google Patents

Internet of things application online compiling method based on multi-user cache Download PDF

Info

Publication number
CN111176654B
CN111176654B CN201911128284.1A CN201911128284A CN111176654B CN 111176654 B CN111176654 B CN 111176654B CN 201911128284 A CN201911128284 A CN 201911128284A CN 111176654 B CN111176654 B CN 111176654B
Authority
CN
China
Prior art keywords
compiling
file
internet
hash value
compiled
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911128284.1A
Other languages
Chinese (zh)
Other versions
CN111176654A (en
Inventor
董玮
高艺
卜佳俊
张甲栋
管高扬
刘汶鑫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang University ZJU
Original Assignee
Zhejiang University ZJU
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang University ZJU filed Critical Zhejiang University ZJU
Priority to CN201911128284.1A priority Critical patent/CN111176654B/en
Publication of CN111176654A publication Critical patent/CN111176654A/en
Application granted granted Critical
Publication of CN111176654B publication Critical patent/CN111176654B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/441Register allocation; Assignment of physical memory space to logical memory space

Abstract

An internet of things application online compiling method based on multi-user cache. The method comprises the following steps: the method comprises the following steps that a developer writes an Internet of things application code at a client side and uploads the code to a compiling server. The server compiles each source file in the application code. Before compiling, firstly, the hash value of the file is calculated, and the target file corresponding to the hash value is searched in the database. If the target file exists, copying the file to the current directory, and compiling the next file; otherwise, the current file is compiled and the compiled file is stored in the memory so that the target file can be reused by the subsequent compiling process. And after all the source files are compiled, returning the compiled result to the client side, and completing the compiling.

Description

Internet of things application online compiling method based on multi-user cache
Technical Field
The invention relates to an Internet of things application online compiling method based on multi-user cache.
Background
With the development of the internet of things technology, a large number of internet of things devices emerge. It is predicted that by 2020, there will be 500 billion internet of things devices worldwide. With the increase of the devices of the internet of things, the application scale and complexity of the internet of things are higher and higher. At present, a traditional internet of things application development mode requires a developer to install a development board driver and a corresponding development environment locally, and an application compiling process is executed locally. There are two main problems with this approach: firstly, the isomerism of thing networking equipment is strong, has the development board of multiple type, for example ESP32-DevKitC, STM32 Nucleo, Arduino Mega etc.. For developers, the corresponding device drivers, development environments and compiling tools need to be installed and configured when different development boards are used, time and labor are wasted, and development time is wasted; secondly, with the development of the internet of things, the complexity and scale of the application at the equipment end are continuously improved, and more computing resources are needed by the application compiling, so that the compiling time is longer and longer, and the development efficiency of the application is reduced.
The Internet of things application online development platform moves the development of the Internet of things application from offline to online, and provides a uniform online code editing and cloud compiling environment for developers. Based on the Internet of things application online development platform, developers do not need to complete complicated configuration locally, only need one computer with a browser to complete the development of the Internet of things application, users do not need to install development environments, compiling tools and equipment drivers locally, and development efficiency is greatly improved. In addition, based on an online compiling mode, cloud computing resources can be expanded in real time according to requirements, and compared with local compiling, compiling time is greatly shortened. At present, some Web-based Internet of things application online development platforms are appeared in the market. Such as Arduino Web Editor, Mbed Online Compiler, etc., improve the development efficiency of the application of the internet of things to a certain extent. However, the above-mentioned tool has the following two main drawbacks: firstly, the supported equipment types are limited, taking Arduino Web Editor as an example, at present, the supported equipment only supports Arduino series equipment, and other types of equipment, such as ESP32-DevKitC, STM32 Nuclear and the like, cannot be developed by using the Arduino Web Editor, so that the compatibility of the system is poor; secondly, such online compilers do not perform speed optimization for multi-user online compilation. At present, an online compiling system generally compiles project files of each user respectively, all the files of the whole project need to be compiled again for each compiling, and the intermediate compiling result of multiple users cannot be utilized, so that the required compiling time is long, and the actual user experience is poor.
In summary, compared with the existing internet of things online compiling system, the internet of things application online compiling method based on the multi-user cache can better utilize the computing resources of the cloud online compiling server, simplify the internet of things application development environment configuration, accelerate the application compiling execution process, reduce the time required by compiling, and improve the internet of things application development efficiency by caching and reusing the multi-user intermediate compiling results.
Disclosure of Invention
The invention provides an internet of things application online compiling method based on multi-user cache, aiming at overcoming the defects in the prior art.
The invention aims to simplify the configuration process of the application development environment of the Internet of things by utilizing an online development environment and a multi-user cache technology, and reduce the time required by the application compilation of the Internet of things by reusing the intermediate compilation result of multiple users, thereby improving the application development efficiency of the Internet of things.
In order to realize the purpose, the technical scheme adopted by the invention is as follows: an Internet of things application online compiling method based on multi-user cache comprises the following steps.
Step 1: a developer writes an Internet of things application code on a client side based on an online Web IDE (integrated development environment), and compresses and uploads a code file to a compiling server.
Step 2: and the compiling server acquires the application codes of the Internet of things to be compiled uploaded by the user and decompresses the code files.
And step 3: and the compiling server calculates the hash value of the code uploaded by the user, searches the hash value in the database and finds out the compiling file corresponding to the hash value. If the hash value is in the database and indicates that the application is compiled before, the compiled file is returned as a compiling result, and the compiling process is ended; if the hash value is not in the database, storing the application code of the Internet of things to be compiled into a memory, storing the file hash value in the database, and continuing the following steps.
And 4, step 4: and compiling each source file in the application codes of the Internet of things to be compiled. Before compiling, firstly, the hash value of the file is calculated, and the target file corresponding to the hash value is searched in a database. If the target file exists, copying the file to the current directory, and compiling the next file; otherwise, compiling the current file and storing the compiled file in a memory.
And 5: and if the memory space is full, deleting the corresponding file by adopting a corresponding file replacement strategy. In order to reduce the number of times of file replacement, each time the size of a cached file reaches a threshold value, a corresponding file replacement strategy is adopted to reduce the size of the cached file to 80% of the threshold value.
Step 6: if the compiling is successful, storing the compiled file into a cache space, and returning the compiled file and compiling success information to a user; otherwise, the compiling error information is returned to the user. This compilation process is complete.
The invention has the beneficial effects that: by introducing the online compiling environment and multi-user cache, the configuration process of the application development environment of the Internet of things is simplified, the time required by compiling the application of the Internet of things is reduced, and therefore the application development efficiency of the Internet of things is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without creative efforts.
FIG. 1 is a diagram of a system architecture for implementing the method of the present invention.
Fig. 2 is a work flow diagram of the method of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, belong to the scope of the present invention.
The embodiment of the invention provides an Internet of things application online compiling method based on multi-user cache, and particularly relates to an Internet of things application online compiling system based on multi-user cache. In the system, the compiling server preferably uses a cloud server, the storage preferably uses a solid state disk built in the server, and the client only needs to use a common desktop computer.
Based on the system, the embodiment of the invention provides an internet of things application online compiling method based on multi-user cache, and a work flow chart of the method is shown in fig. 2, and the method specifically comprises the following steps:
step 1: the method comprises the steps that a user compiles an application code of the Internet of things at a client, the client compresses the application code in a ZIP mode, a code compiling mode is designated, and a compressed file is uploaded to a compiling server. The client and the server communicate via the HTTP protocol.
Step 2: the method comprises the steps that a compiling server obtains an Internet of things application code to be compiled, which is uploaded by a user, wherein the application code consists of one or more files and is compressed by adopting a ZIP format.
And step 3: and the compiling server calculates the hash value of the code uploaded by the user, searches the hash value in the database and finds out the compiling file corresponding to the hash value. According to different search results, the following two processes are respectively carried out.
(3.1) if the hash value is in the database, indicating that the application has been previously compiled. Searching a compiling file path corresponding to the hash value in a database, returning the compiling file as a compiling result, and ending the compiling process;
(3.2) if the hash value is not in the database, indicating that the application has not been previously compiled. Storing the application code of the Internet of things to be compiled into a memory, inserting the hash value of the project compression file into a database, and continuing the following steps.
And 4, step 4: and compiling each source file in the application codes of the Internet of things to be compiled. Before compilation, the hash value of the file is first calculated, and in this system implementation, we use the MD5 code of the file as the hash value of the file. Then, the target file corresponding to the hash value is searched in the database. According to whether the target file exists or not, the following two processes are respectively carried out.
(4.1) if the target file exists, copying the target file to the current compiling directory, skipping the compiling of the current file, and compiling the next file;
and (4.2) if the target file does not exist, compiling the current source file according to a compiling mode specified by the client, storing the hash value of the source file and the target file path into a database, and storing the compiled file into a memory. The specific compiling mode may use an open source compiling tool such as GCC, which is not described in detail in the present invention.
And 5: if the memory space is full, a least recently used replacement policy (LRU) is employed to select the least recently used target file and delete the corresponding database record and target file. To reduce the number of file replacements, each time a file is deleted, we select 20% of the target files for deletion based on the LRU algorithm. The file replacement policy and the number of deleted files are only an optimal implementation manner, and the specific policy selection and parameter value can be set according to actual needs.
Step 6: if the application is compiled successfully, the compiled file is put into a memory, and a compiling result is returned to the client; otherwise, the compiling error information is returned to the client side, and one-time compiling process is completed.
The embodiments described in this specification are merely illustrative of implementations of the inventive concept and the scope of the present invention should not be considered limited to the specific forms set forth in the embodiments but rather by the equivalents thereof as may occur to those skilled in the art upon consideration of the present inventive concept.

Claims (3)

1. An Internet of things application online compiling method based on multi-user cache comprises the following steps:
step 1: a user compiles an application code of the Internet of things at a client, the client compresses the application code in a ZIP mode, specifies a code compiling mode and uploads a compressed file to a compiling server; the client and the server communicate through an HTTP (hyper text transport protocol);
step 2: the method comprises the steps that a compiling server obtains an Internet of things application code to be compiled, which is uploaded by a user, wherein the application code consists of one or more files and is compressed by adopting a ZIP format;
and step 3: the compiling server calculates a hash value of the code uploaded by the user, searches the hash value in a database and finds a compiling file corresponding to the hash value; according to different search results, respectively carrying out the following two processes;
3.1: if the hash value is in the database, it indicates that the application has been compiled before; searching a compiling file path corresponding to the hash value in a database, returning the compiling file as a compiling result, and ending the compiling process;
3.2: if the hash value is not in the database, it indicates that the application has not been compiled before; storing the application code of the Internet of things to be compiled into a memory, inserting the hash value of the project compressed file into a database, and continuing the following steps;
and 4, step 4: compiling each source file in the application codes of the internet of things to be compiled; before compiling, firstly calculating the hash value of the file, and using the MD5 code of the file as the hash value of the file; then, searching a target file corresponding to the hash value in a database; respectively carrying out the following two processes according to the existence of the target file;
4.1: if the target file exists, copying the target file to the current compiling directory, skipping the compiling of the current file, and compiling the next file;
4.2: if the target file does not exist, compiling the current source file according to a compiling mode specified by the client, storing the hash value of the source file and the target file path into a database, and storing the compiled file into a memory;
and 5: if the memory space is full, adopting a least recently used replacement strategy LRU, selecting a target file which is not used for the most recent time, and deleting the corresponding database record and the target file;
step 6: if the application is compiled successfully, the compiled file is put into a memory, and a compiling result is returned to the client; otherwise, the compiling error information is returned to the client side, and one-time compiling process is completed.
2. The multi-user cache based internet of things application online compiling method of claim 1, wherein: the compiling mode of the step 4.2 uses a GCC open source compiling tool.
3. The multi-user cache based internet of things application online compiling method of claim 1, wherein: and 5, when the target file is deleted, in order to reduce the file replacement times, each time the file is deleted, based on the LRU algorithm, 20% of the target files are selected for deletion.
CN201911128284.1A 2019-11-18 2019-11-18 Internet of things application online compiling method based on multi-user cache Active CN111176654B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911128284.1A CN111176654B (en) 2019-11-18 2019-11-18 Internet of things application online compiling method based on multi-user cache

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911128284.1A CN111176654B (en) 2019-11-18 2019-11-18 Internet of things application online compiling method based on multi-user cache

Publications (2)

Publication Number Publication Date
CN111176654A CN111176654A (en) 2020-05-19
CN111176654B true CN111176654B (en) 2021-04-27

Family

ID=70622328

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911128284.1A Active CN111176654B (en) 2019-11-18 2019-11-18 Internet of things application online compiling method based on multi-user cache

Country Status (1)

Country Link
CN (1) CN111176654B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112445489A (en) * 2020-10-29 2021-03-05 成都完美天智游科技有限公司 Compiling system, electronic device, and readable medium
CN112596733B (en) * 2020-12-15 2024-01-05 北京五一视界数字孪生科技股份有限公司 Method, device, storage medium and electronic equipment for compiling and acquiring files
CN113360135B (en) * 2021-04-21 2022-05-24 浙江大学 Heterogeneous Internet of things application remote compiling method based on elastic expansion
CN113051226A (en) * 2021-06-02 2021-06-29 芯华章科技股份有限公司 System level compiling method, electronic device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102520922A (en) * 2011-11-14 2012-06-27 上海交通大学 Remote development method and system under coordination environment
CN103136029A (en) * 2013-03-12 2013-06-05 无锡江南计算技术研究所 Real-time compiling system self-adapting adjusting and optimizing method
CN103713889A (en) * 2012-09-29 2014-04-09 三亚中兴软件有限责任公司 Method and device for developing, compiling and debugging application
CN109271166A (en) * 2018-09-20 2019-01-25 摩尔元数(厦门)科技有限公司 A kind of method and platform for realizing compiled online at the end Web

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8286196B2 (en) * 2007-05-03 2012-10-09 Apple Inc. Parallel runtime execution on multiple processors
CN102148654A (en) * 2010-02-10 2011-08-10 北京易路联动技术有限公司 System and method based on network side compiling
CN104572194B (en) * 2014-12-30 2019-03-08 北京奇虎科技有限公司 A kind of module loading method and apparatus
CN106648597A (en) * 2016-10-10 2017-05-10 许继集团有限公司 Multi-user concurrent remote compiling engine architecture
CN107368292B (en) * 2017-03-29 2020-06-12 阿里巴巴集团控股有限公司 Resource compiling method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102520922A (en) * 2011-11-14 2012-06-27 上海交通大学 Remote development method and system under coordination environment
CN103713889A (en) * 2012-09-29 2014-04-09 三亚中兴软件有限责任公司 Method and device for developing, compiling and debugging application
CN103136029A (en) * 2013-03-12 2013-06-05 无锡江南计算技术研究所 Real-time compiling system self-adapting adjusting and optimizing method
CN109271166A (en) * 2018-09-20 2019-01-25 摩尔元数(厦门)科技有限公司 A kind of method and platform for realizing compiled online at the end Web

Also Published As

Publication number Publication date
CN111176654A (en) 2020-05-19

Similar Documents

Publication Publication Date Title
CN111176654B (en) Internet of things application online compiling method based on multi-user cache
KR102010508B1 (en) System and method for updating source code files
US7694291B2 (en) Build optimizer tool for efficient management of software builds for mobile devices
US9811321B1 (en) Script compilation
CN111209005B (en) Method and apparatus for compiling program file, and computer-readable storage medium
US8296268B2 (en) System and method for change logging in a firmware over the air development environment
CN105335137A (en) Method and device used for processing source file
US6934940B2 (en) Source code transformation-temporary object reduction
CN109918076B (en) Code file processing method, system, computer device and readable storage medium
EP1691282A1 (en) Build optimizer tool for efficient management of software builds for mobile devices
CN110058861B (en) Source code processing method and device, storage medium and electronic equipment
CN111049889B (en) Static resource uploading method and device, integrated server and system
CN111610978A (en) Applet conversion method, device, equipment and storage medium
CN112882718B (en) Compiling processing method, device, equipment and storage medium
JP2005085255A (en) Method and device for developing source program on target system base
CN106055334A (en) Code management system and method
CN108549537A (en) The method and system of user data acquisition based on Android terminal
EP2771788B1 (en) Methods and apparatuses for computing checksums for effective caching in continuous distributed builds
CN115268879A (en) Code processing method and device, electronic equipment and storage medium
US10656922B2 (en) Systems and methods for providing an application transformation tool
WO2015003452A1 (en) Methods and systems for file processing
CN110362317B (en) Code conversion method, device and storage medium
US8949802B1 (en) Sharding program compilation for large-scale static analysis
CN111400243B (en) Development management system based on pipeline service and file storage method and device
CN112596706A (en) Patterned code generation method, device and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant