Microservice manager and optimizer

Information

  • Patent Grant
  • 11349909
  • Patent Number
    11,349,909
  • Date Filed
    Monday, July 6, 2020
    4 years ago
  • Date Issued
    Tuesday, May 31, 2022
    2 years ago
Abstract
In one embodiment, an agent executed by a device detects an invocation that is made using Java reflection of a method associated with a microservice. The agent instruments the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice. The agent optimizes the invocation of the method associated with the microservice. The agent provides the one or more metrics regarding the microservice to a user interface.
Description
TECHNICAL FIELD

The present disclosure relates generally to computer systems, and, more particularly, to a microservice manager and optimizer.


BACKGROUND

The Internet and the World Wide Web have enabled the proliferation of web services available for virtually all types of businesses. Due to the accompanying complexity of the infrastructure supporting the web services, it is becoming increasingly difficult to maintain the highest level of service performance and user experience to keep up with the increase in web services. For example, it can be challenging to piece together monitoring and logging data across disparate systems, tools, and layers in a network architecture. Moreover, even when data can be obtained, it is difficult to directly connect the chain of events and cause and effect. To this end, various application performance management (APM) solutions have emerged that typically rely on instrumentation, which is the process of inserting code into an application, to capture performance data.


Recently, microservices have emerged as a major paradigm shift in the computing world. Rather than deploying monolithic applications, many companies are now choosing instead to develop scalable microservices that break the tasks of the application into individual runtimes, to handle the web service calls. In the context of the Java programming language, there are now multiple frameworks designed to support microservices. To do so, these platforms typically operate by exposing Representational State Transfer (REST) endpoints, which perform specific services. Microservices also typically use runtimes that are much smaller in terms of memory and much more dynamic than monolithic applications. Consequently, traditional APM solutions are not well suited for microservice frameworks, as their additional overhead may not be compatible with the resource constraints found in microservice frameworks.





BRIEF DESCRIPTION OF THE DRAWINGS

The embodiments herein may be better understood by referring to the following description in conjunction with the accompanying drawings in which like reference numerals indicate identically or functionally similar elements, of which:



FIGS. 1A-1B illustrate an example computer network;



FIG. 2 illustrates an example computing device/node;



FIG. 3 illustrates an example application intelligence platform;



FIG. 4 illustrates an example system for implementing the example application intelligence platform;



FIG. 5 illustrates an example computing system;



FIG. 6 illustrates an example simplified architecture for a microservice framework with an agent;



FIG. 7 illustrates an example folder structure for an agent;



FIGS. 8A-8D illustrate examples output of a prototype implementing the is techniques herein; and



FIG. 9 illustrates an example simplified procedure for instrumenting and optimizing a microservice-based application, in accordance with one or more embodiments described herein.





DESCRIPTION OF EXAMPLE EMBODIMENTS

Overview


According to one or more embodiments of the disclosure, an agent executed by a device detects an invocation that is made using Java reflection of a method associated with a microservice. The agent instruments the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice. The agent optimizes the invocation of the method associated with the microservice. The agent provides the one or more metrics regarding the microservice to a user interface.


Other embodiments are described below, and this overview is not meant to limit the scope of the present disclosure.


DESCRIPTION

A computer network is a geographically distributed collection of nodes interconnected by communication links and segments for transporting data between end nodes, such as personal computers and workstations, or other devices, such as sensors, etc. Many types of networks are available, ranging from local area networks (LANs) to wide area networks (WANs). LANs typically connect the nodes over dedicated private communications links located in the same general physical location, such as a building or campus. WANs, on the other hand, typically connect geographically dispersed nodes over long-distance communications links, such as common carrier telephone lines, optical lightpaths, synchronous optical networks (SONET), synchronous digital hierarchy (SDH) links, or Powerline Communications (PLC), and others. The Internet is an example of a WAN that connects disparate networks throughout the world, providing global communication between nodes on various networks. Other types of networks, such as field area networks (FANs), neighborhood area networks (NANs), personal area networks (PANs), enterprise networks, etc. may also make up the components of any given computer network.


The nodes typically communicate over the network by exchanging discrete frames or packets of data according to predefined protocols, such as the Transmission Control Protocol/Internet Protocol (TCP/IP). In this context, a protocol consists of a set of rules defining how the nodes interact with each other. Computer networks may be further interconnected by an intermediate network node, such as a router, to extend the effective “size” of each network.


Smart object networks, such as sensor networks, in particular, are a specific type of network having spatially distributed autonomous devices such as sensors, actuators, etc., that cooperatively monitor physical or environmental conditions at different locations, such as, e.g., energy/power consumption, resource consumption (e.g., water/gas/etc. for advanced metering infrastructure or “AMI” applications) temperature, pressure, vibration, sound, radiation, motion, pollutants, etc. Other types of smart objects include actuators, e.g., responsible for turning on/off an engine or perform any other actions. Sensor networks, a type of smart object network, are typically shared-media networks, such as wireless or power-line communication networks. That is, in addition to one or more sensors, each sensor device (node) in a sensor network may generally be equipped with a radio transceiver or other communication port, a microcontroller, and an energy source, such as a battery. Generally, size and cost constraints on smart object nodes (e.g., sensors) result in corresponding constraints on resources such as energy, memory, computational speed and bandwidth.



FIG. 1A is a schematic block diagram of an example computer network 100 illustratively comprising nodes/devices, such as a plurality of routers/devices is interconnected by links or networks, as shown. For example, customer edge (CE) routers 110 may be interconnected with provider edge (PE) routers 120 (e.g., PE-1, PE-2, and PE-3) in order to communicate across a core network, such as an illustrative network backbone 130. For example, routers 110, 120 may be interconnected by the public Internet, a multiprotocol label switching (MPLS) virtual private network (VPN), or the like. Data packets 140 (e.g., traffic/messages) may be exchanged among the nodes/devices of the computer network 100 over links using predefined network communication protocols such as the Transmission Control Protocol/Internet Protocol (TCP/IP), User Datagram Protocol (UDP), Asynchronous Transfer Mode (ATM) protocol, Frame Relay protocol, or any other suitable protocol. Those skilled in the art will understand that any number of nodes, devices, links, etc. may be used in the computer network, and that the view shown herein is for simplicity.


In some implementations, a router or a set of routers may be connected to a private network (e.g., dedicated leased lines, an optical network, etc.) or a virtual private network (VPN), such as an MPLS VPN thanks to a carrier network, via one or more links exhibiting very different network and service level agreement characteristics.



FIG. 1B illustrates an example of network 100 in greater detail, according to various embodiments. As shown, network backbone 130 may provide connectivity between devices located in different geographical areas and/or different types of local networks. For example, network 100 may comprise local/branch networks 160, 162 that include devices/nodes 10-16 and devices/nodes 18-20, respectively, as well as a data center/cloud environment 150 that includes servers 152-154. Notably, local networks 160-162 and data center/cloud environment 150 may be located in different geographic locations. Servers 152-154 may include, in various embodiments, any number of suitable servers or other cloud-based resources. As would be appreciated, network 100 may include any number of local networks, data centers, cloud environments, devices/nodes, servers, etc.


In some embodiments, the techniques herein may be applied to other network is topologies and configurations. For example, the techniques herein may be applied to peering points with high-speed links, data centers, etc. Furthermore, in various embodiments, network 100 may include one or more mesh networks, such as an Internet of Things network. Loosely, the term “Internet of Things” or “IoT” refers to uniquely identifiable objects (things) and their virtual representations in a network-based architecture. In particular, the next frontier in the evolution of the Internet is the ability to connect more than just computers and communications devices, but rather the ability to connect “objects” in general, such as lights, appliances, vehicles, heating, ventilating, and air-conditioning (HVAC), windows and window shades and blinds, doors, locks, etc. The “Internet of Things” thus generally refers to the interconnection of objects (e.g., smart objects), such as sensors and actuators, over a computer network (e.g., via IP), which may be the public Internet or a private network.


Notably, shared-media mesh networks, such as wireless networks, are often on what is referred to as Low-Power and Lossy Networks (LLNs), which are a class of network in which both the routers and their interconnect are constrained: LLN routers typically operate with constraints, e.g., processing power, memory, and/or energy (battery), and their interconnects are characterized by, illustratively, high loss rates, low data rates, and/or instability. LLNs are comprised of anything from a few dozen to thousands or even millions of LLN routers, and support point-to-point traffic (between devices inside the LLN), point-to-multipoint traffic (from a central control point such at the root node to a subset of devices inside the LLN), and multipoint-to-point traffic (from devices inside the LLN towards a central control point). Often, an IoT network is implemented with an LLN-like architecture. For example, as shown, local network 160 may be an LLN in which CE-2 operates as a root node for nodes/devices 10-16 in the local mesh, in some embodiments.



FIG. 2 is a schematic block diagram of an example computing device (e.g., apparatus) 200 that may be used with one or more embodiments described herein, e.g., as any of the devices shown in FIGS. 1A-1B above, and particularly as specific devices as described further below. The device may comprise one or more network interfaces 210 (e.g., wired, wireless, etc.), at least one processor 220, and a memory 240 interconnected by a system bus 250, as well as a power supply 260 (e.g., battery, plug-in, etc.).


The network interface(s) 210 contain the mechanical, electrical, and signaling circuitry for communicating data over links coupled to the network 100, e.g., providing a data connection between device 200 and the data network, such as the Internet. The network interfaces may be configured to transmit and/or receive data using a variety of different communication protocols. For example, interfaces 210 may include wired transceivers, wireless transceivers, cellular transceivers, or the like, each to allow device 200 to communicate information to and from a remote computing device or server over an appropriate network. The same network interfaces 210 also allow communities of multiple devices 200 to interconnect among themselves, either peer-to-peer, or up and down a hierarchy. Note, further, that the nodes may have two different types of network connections 210, e.g., wireless and wired/physical connections, and that the view herein is merely for illustration. Also, while the network interface 210 is shown separately from power supply 260, for devices using powerline communication (PLC) or Power over Ethernet (PoE), the network interface 210 may communicate through the power supply 260, or may be an integral component of the power supply.


The memory 240 comprises a plurality of storage locations that are addressable by the processor 220 and the network interfaces 210 for storing software programs and data structures associated with the embodiments described herein. The processor 220 may comprise hardware elements or hardware logic adapted to execute the software programs and manipulate the data structures 245. An operating system 242, portions of which are typically resident in memory 240 and executed by the processor, functionally organizes the device by, among other things, invoking operations in support of software processes and/or services executing on the device. These software processes and/or services may comprise one or more functional processes 246, and on certain devices, an illustrative “application monitoring” process 248, as described herein. Notably, functional processes 246, when executed by processor(s) 220, cause each particular device 200 to perform the various functions corresponding to the particular device's purpose and general configuration. For example, a router would be configured to operate as a router, a server would be configured to operate as a server, an access point (or gateway) would be configured to operate as an access point (or gateway), a client device would be configured to operate as a client device, and so on.


It will be apparent to those skilled in the art that other processor and memory types, including various computer-readable media, may be used to store and execute program instructions pertaining to the techniques described herein. Also, while the description illustrates various processes, it is expressly contemplated that various processes may be embodied as modules configured to operate in accordance with the techniques herein (e.g., according to the functionality of a similar process). Further, while the processes have been shown separately, those skilled in the art will appreciate that processes may be routines or modules within other processes.


Application Intelligence Platform


The embodiments herein relate to an application intelligence platform for application performance management. In one aspect, as discussed with respect to FIGS. 3-5 below, performance within a networking environment may be monitored, specifically by monitoring applications and entities (e.g., transactions, tiers, nodes, and machines) in the networking environment using agents installed at individual machines at the entities. As an example, applications may be configured to run on one or more machines (e.g., a customer will typically run one or more nodes on a machine, where an application consists of one or more tiers, and a tier consists of one or more nodes). The agents collect data associated with the applications of interest and associated nodes and machines where the applications are being operated. Examples of the collected data may include performance data (e.g., metrics, metadata, etc.) and topology data (e.g., indicating relationship information). The agent-collected data may then be provided to one or more servers or controllers to analyze the data.



FIG. 3 is a block diagram of an example application intelligence platform 300 that can implement one or more aspects of the techniques herein. The application intelligence platform is a system that monitors and collects metrics of performance data for an application environment being monitored. At the simplest structure, the application intelligence platform includes one or more agents 310 and one or more servers/controllers 320. Note that while FIG. 3 shows four agents (e.g., Agent 1 through Agent 4) communicatively linked to a single controller, the total number of agents and controllers can vary based on a number of factors including the number of applications monitored, how distributed the application environment is, the level of monitoring desired, the level of user experience desired, and so on.


The controller 320 is the central processing and administration server for the application intelligence platform. The controller 320 serves a browser-based user interface (UI) 330 that is the primary interface for monitoring, analyzing, and troubleshooting the monitored environment. The controller 320 can control and manage monitoring of business transactions (described below) distributed over application servers. Specifically, the controller 320 can receive runtime data from agents 310 (and/or other coordinator devices), associate portions of business transaction data, communicate with agents to configure collection of runtime data, and provide performance data and reporting through the interface 330. The interface 330 may be viewed as a web-based interface viewable by a client device 340. In some implementations, a client device 340 can directly communicate with controller 320 to view an interface for monitoring data. The controller 320 can include a visualization system 350 for displaying the reports and dashboards related to the disclosed technology. In some implementations, the visualization system 350 can be implemented in a separate machine (e.g., a server) different from the one hosting the controller 320.


Notably, in an illustrative Software as a Service (SaaS) implementation, a controller instance 320 may be hosted remotely by a provider of the application intelligence platform 300. In an illustrative on-premises (On-Prem) implementation, a controller instance 320 may be installed locally and self-administered.


The controllers 320 receive data from different agents 310 (e.g., Agents 1-4) deployed to monitor applications, databases and database servers, servers, and end user clients for the monitored environment. Any of the agents 310 can be implemented as different types of agents with specific monitoring duties. For example, application agents may be installed on each server that hosts applications to be monitored. Instrumenting an agent adds an application agent into the runtime process of the application.


Database agents, for example, may be software (e.g., a Java program) installed on a machine that has network access to the monitored databases and the controller. Database agents query the monitored databases in order to collect metrics and pass those metrics along for display in a metric browser (e.g., for database monitoring and analysis within databases pages of the controller's UI 330). Multiple database agents can report to the same controller. Additional database agents can be implemented as backup database agents to take over for the primary database agents during a failure or planned machine downtime. The additional database agents can run on the same machine as the primary agents or on different machines. A database agent can be deployed in each distinct network of the monitored environment. Multiple database agents can run under different user accounts on the same machine.


Standalone machine agents, on the other hand, may be standalone programs (e.g., standalone Java programs) that collect hardware-related performance statistics from the servers (or other suitable devices) in the monitored environment. The standalone machine agents can be deployed on machines that host application servers, database servers, messaging servers, Web servers, etc. A standalone machine agent has an extensible architecture (e.g., designed to accommodate changes).


End user monitoring (EUM) may be performed using browser agents and mobile agents to provide performance information from the point of view of the client, such as a web browser or a mobile native application. Through EUM, web use, mobile use, or combinations thereof (e.g., by real users or synthetic agents) can be monitored based on the monitoring needs. Notably, browser agents (e.g., agents 310) can include Reporters that report monitored data to the controller.


Monitoring through browser agents and mobile agents are generally unlike monitoring through application agents, database agents, and standalone machine agents that are on the server. In particular, browser agents may generally be embodied as small files using web-based technologies, such as JavaScript agents injected into each instrumented web page (e.g., as close to the top as possible) as the web page is served, and are configured to collect data. Once the web page has completed loading, the collected data may be bundled into a beacon and sent to an EUM process/cloud for processing and made ready for retrieval by the controller. Browser real user monitoring (Browser RUM) provides insights into the performance of a web application from the point of view of a real or synthetic end user. For example, Browser RUM can determine how specific Ajax or iframe calls are slowing down page load time and how server performance impact end user experience in aggregate or in individual cases.


A mobile agent, on the other hand, may be a small piece of highly performant code that gets added to the source of the mobile application. Mobile RUM provides information on the native mobile application (e.g., iOS or Android applications) as the end users actually use the mobile application. Mobile RUM provides visibility into the functioning of the mobile application itself and the mobile application's interaction with the network used and any server-side applications with which the mobile application communicates.


Application Intelligence Monitoring: The disclosed technology can provide application intelligence data by monitoring an application environment that includes various services such as web applications served from an application server (e.g., Java virtual machine (JVM), Internet Information Services (IIS), Hypertext Preprocessor (PHP) Web server, etc.), databases or other data stores, and remote services such as message queues and caches. The services in the application environment can interact in various ways to provide a set of cohesive user interactions with the application, such as a set of user services applicable to end user customers.


Application Intelligence Modeling: Entities in the application environment (such as the JBoss service, MQSeries modules, and databases) and the services provided by the entities (such as a login transaction, service or product search, or purchase transaction) may be mapped to an application intelligence model. In the application intelligence model, a business transaction represents a particular service provided by the monitored environment. For example, in an e-commerce application, particular real-world services can include a user logging in, searching for items, or adding items to the cart. In a content portal, particular real-world services can include user requests for content such as sports, business, or entertainment news. In a stock trading application, particular real-world services can include operations such as receiving a stock quote, buying, or selling stocks.


Business Transactions: A business transaction representation of the particular service provided by the monitored environment provides a view on performance data in the context of the various tiers that participate in processing a particular request. A business transaction, which may each be identified by a unique business transaction identification (ID), represents the end-to-end processing path used to fulfill a service request in the monitored environment (e.g., adding items to a shopping cart, storing information in a database, purchasing an item online, etc.). Thus, a business transaction is a type of user-initiated action in the monitored environment defined by an entry point and a processing path across application servers, databases, and potentially many other infrastructure components. Each instance of a business transaction is an execution of that transaction in response to a particular user request (e.g., a socket call, illustratively associated with the TCP layer). A business transaction can be created by detecting incoming requests at an entry point and tracking the activity associated with request at the originating tier and across distributed components in the application environment (e.g., associating the business transaction with a 4-tuple of a source IP address, source port, destination IP address, and destination port). A flow map can be generated for a business transaction that shows the touch points for the business transaction in the application environment. In one embodiment, a specific tag may be added to packets by application specific agents for identifying business transactions (e.g., a custom header field attached to a hypertext transfer protocol (HTTP) payload by an application agent, or by a network agent when an application makes a remote socket call), such that packets can be examined by network agents to identify the business transaction identifier (ID) (e.g., a Globally Unique Identifier (GUID) or Universally Unique Identifier (UUID)).


Performance monitoring can be oriented by business transaction to focus on the performance of the services in the application environment from the perspective of end users. Performance monitoring based on business transactions can provide information on whether a service is available (e.g., users can log in, check out, or view their data), response times for users, and the cause of problems when the problems occur.


A business application is the top-level container in the application intelligence model. A business application contains a set of related services and business transactions. In some implementations, a single business application may be needed to model the environment. In some implementations, the application intelligence model of the application environment can be divided into several business applications. Business applications can be organized differently based on the specifics of the application environment. One consideration is to organize the business applications in a way that reflects work teams in a particular organization, since role-based access controls in the Controller UI are oriented by business application.


A node in the application intelligence model corresponds to a monitored server or JVM in the application environment. A node is the smallest unit of the modeled environment. In general, a node corresponds to an individual application server, JVM, or Common Language Runtime (CLR) on which a monitoring Agent is installed. Each node identifies itself in the application intelligence model. The Agent installed at the node is configured to specify the name of the node, tier, and business application under which the Agent reports data to the Controller.


Business applications contain tiers, the unit in the application intelligence model that includes one or more nodes. Each node represents an instrumented service (such as a web application). While a node can be a distinct application in the application environment, in the application intelligence model, a node is a member of a tier, which, is along with possibly many other tiers, make up the overall logical business application.


Tiers can be organized in the application intelligence model depending on a mental model of the monitored application environment. For example, identical nodes can be grouped into a single tier (such as a cluster of redundant servers). In some implementations, any set of nodes, identical or not, can be grouped for the purpose of treating certain performance metrics as a unit into a single tier.


The traffic in a business application flows among tiers and can be visualized in a flow map using lines among tiers. In addition, the lines indicating the traffic flows among tiers can be annotated with performance metrics. In the application intelligence model, there may not be any interaction among nodes within a single tier. Also, in some implementations, an application agent node cannot belong to more than one tier. Similarly, a machine agent cannot belong to more than one tier. However, more than one machine agent can be installed on a machine.


A backend is a component that participates in the processing of a business transaction instance. A backend is not instrumented by an agent. A backend may be a web server, database, message queue, or other type of service. The agent recognizes calls to these backend services from instrumented code (called exit calls). When a service is not instrumented and cannot continue the transaction context of the call, the agent determines that the service is a backend component. The agent picks up the transaction context at the response at the backend and continues to follow the context of the transaction from there.


Performance information is available for the backend call. For detailed transaction analysis for the leg of a transaction processed by the backend, the database, web service, or other application need to be instrumented.


The application intelligence platform uses both self-learned baselines and configurable thresholds to help identify application issues. A complex distributed application has a large number of performance metrics and each metric is important in one or more contexts. In such environments, it is difficult to determine the values or ranges that are normal for a particular metric; set meaningful thresholds on which to base and receive relevant alerts; and determine what is a “normal” metric when the application or infrastructure undergoes change. For these reasons, the disclosed application intelligence platform can perform anomaly detection based on dynamic baselines or thresholds.


The disclosed application intelligence platform automatically calculates dynamic baselines for the monitored metrics, defining what is “normal” for each metric based on actual usage. The application intelligence platform uses these baselines to identify subsequent metrics whose values fall out of this normal range. Static thresholds that are tedious to set up and, in rapidly changing application environments, error-prone, are no longer needed.


The disclosed application intelligence platform can use configurable thresholds to maintain service level agreements (SLAs) and ensure optimum performance levels for system by detecting slow, very slow, and stalled transactions. Configurable thresholds provide a flexible way to associate the right business context with a slow request to isolate the root cause.


In addition, health rules can be set up with conditions that use the dynamically generated baselines to trigger alerts or initiate other types of remedial actions when performance problems are occurring or may be about to occur.


For example, dynamic baselines can be used to automatically establish what is considered normal behavior for a particular application. Policies and health rules can be used against baselines or other health indicators for a particular application to detect and troubleshoot problems before users are affected. Health rules can be used to define metric conditions to monitor, such as when the “average response time is four times slower than the baseline”. The health rules can be created and modified based on the monitored application environment.


Examples of health rules for testing business transaction performance can include business transaction response time and business transaction error rate. For example, health rule that tests whether the business transaction response time is much higher than normal can define a critical condition as the combination of an average response time greater than the default baseline by 3 standard deviations and a load greater than 50 calls per minute. In some implementations, this health rule can define a warning condition as the combination of an average response time greater than the default baseline by 2 standard deviations and a load greater than 100 calls per minute. In some implementations, the health rule that tests whether the business transaction error rate is much higher than normal can define a critical condition as the combination of an error rate greater than the default baseline by 3 standard deviations and an error rate greater than 10 errors per minute and a load greater than 50 calls per minute. In some implementations, this health rule can define a warning condition as the combination of an error rate greater than the default baseline by 2 standard deviations and an error rate greater than 5 errors per minute and a load greater than 50 calls per minute. These are non-exhaustive and non-limiting examples of health rules and other health rules can be defined as desired by the user.


Policies can be configured to trigger actions when a health rule is violated or when any event occurs. Triggered actions can include notifications, diagnostic actions, auto-scaling capacity, running remediation scripts.


Most of the metrics relate to the overall performance of the application or business transaction (e.g., load, average response time, error rate, etc.) or of the application server infrastructure (e.g., percentage CPU busy, percentage of memory used, etc.). The Metric Browser in the controller UI can be used to view all of the metrics that the agents report to the controller.


In addition, special metrics called information points can be created to report on how a given business (as opposed to a given application) is performing. For example, the performance of the total revenue for a certain product or set of products can be monitored. Also, information points can be used to report on how a given code is performing, for example how many times a specific method is called and how long it is taking to execute. Moreover, extensions that use the machine agent can be created to report user defined custom metrics. These custom metrics are base-lined and reported in the controller, just like the built-in metrics.


All metrics can be accessed programmatically using a Representational State Transfer (REST) application programming interface (API) that returns either the JavaScript Object Notation (JSON) or the eXtensible Markup Language (XML) format. Also, the REST API can be used to query and manipulate the application environment.


Snapshots provide a detailed picture of a given application at a certain point in time. Snapshots usually include call graphs that allow that enables drilling down to the line of code that may be causing performance problems. The most common snapshots are transaction snapshots.



FIG. 4 illustrates an example application intelligence platform (system) 400 for performing one or more aspects of the techniques herein. The system 400 in FIG. 4 includes client device 405 and 492, mobile device 415, network 420, network server 425, application servers 430, 440, 450, and 460, asynchronous network machine 470, data stores 480 and 485, controller 490, and data collection server 495. The controller 490 can include visualization system 496 for providing displaying of the report generated for performing the field name recommendations for field extraction as disclosed in the present disclosure. In some implementations, the visualization system 496 can be implemented in a separate machine (e.g., a server) different from the one hosting the controller 490.


Client device 405 may include network browser 410 and be implemented as a computing device, such as for example a laptop, desktop, workstation, or some other computing device. Network browser 410 may be a client application for viewing content provided by an application server, such as application server 430 via network server 425 over network 420.


Network browser 410 may include agent 412. Agent 412 may be installed on network browser 410 and/or client 405 as a network browser add-on, downloading the application to the server, or in some other manner. Agent 412 may be executed to monitor network browser 410, the operating system of client 405, and any other application, API, or another component of client 405. Agent 412 may determine network browser navigation timing metrics, access browser cookies, monitor code, and transmit data to data collection 495, controller 490, or another device. Agent 412 may perform other operations related to monitoring a request or a network at client 405 as discussed herein including report generating.


Mobile device 415 is connected to network 420 and may be implemented as a portable device suitable for sending and receiving content over a network, such as for example a mobile phone, smart phone, tablet computer, or other portable device. Both client device 405 and mobile device 415 may include hardware and/or software configured to access a web service provided by network server 425.


Mobile device 415 may include network browser 417 and an agent 419. Mobile device may also include client applications and other code that may be monitored by agent 419. Agent 419 may reside in and/or communicate with network browser 417, as well as communicate with other applications, an operating system, APIs and other hardware and software on mobile device 415. Agent 419 may have similar functionality as that described herein for agent 412 on client 405, and may report data to data collection server 495 and/or controller 490.


Network 420 may facilitate communication of data among different servers, devices and machines of system 400 (some connections shown with lines to network 420, some not shown). The network may be implemented as a private network, public network, intranet, the Internet, a cellular network, Wi-Fi network, VoIP network, or a combination of one or more of these networks. The network 420 may include one or more machines such as load balance machines and other machines.


Network server 425 is connected to network 420 and may receive and process requests received over network 420. Network server 425 may be implemented as one or more servers implementing a network service, and may be implemented on the same machine as application server 430 or one or more separate machines. When network 420 is the Internet, network server 425 may be implemented as a web server.


Application server 430 communicates with network server 425, application servers 440 and 450, and controller 490. Application server 450 may also communicate with other machines and devices (not illustrated in FIG. 4). Application server 430 may host an application or portions of a distributed application. The host application 432 may be in one of many platforms, such as including a Java, PHP, .Net, and Node.JS, be implemented as a Java virtual machine, or include some other host type. Application server 430 may also include one or more agents 434 (i.e., “modules”), including a language agent, machine agent, and network agent, and other software modules. Application server 430 may be implemented as one server or multiple servers as illustrated in FIG. 4.


Application 432 and other software on application server 430 may be instrumented using byte code insertion, or byte code instrumentation (BCI), to modify the object code of the application or other software. The instrumented object code may include code used to detect calls received by application 432, calls sent by application 432, and communicate with agent 434 during execution of the application. BCI may also be used to monitor one or more sockets of the application and/or application server in order to monitor the socket and capture packets coming over the socket.


In some embodiments, server 430 may include applications and/or code other than a virtual machine. For example, servers 430, 440, 450, and 460 may each include Java code, .Net code, PHP code, Ruby code, C code, C++ or other binary code to implement applications and process requests received from a remote source. References to a virtual machine with respect to an application server are intended to be for exemplary purposes only.


Agents 434 on application server 430 may be installed, downloaded, embedded, or otherwise provided on application server 430. For example, agents 434 may be provided in server 430 by instrumentation of object code, downloading the agents to the server, or in some other manner. Agent 434 may be executed to monitor application server 430, monitor code running in a virtual machine 432 (or other program language, such as a PHP, .Net, or C program), machine resources, network layer data, and communicate with byte instrumented code on application server 430 and one or more applications on application server 430.


Each of agents 434, 444, 454, and 464 may include one or more agents, such as language agents, machine agents, and network agents. A language agent may be a type of agent that is suitable to run on a particular host. Examples of language agents include a Java agent, .Net agent, PHP agent, and other agents. The machine agent may collect data from a particular machine on which it is installed. A network agent may capture network information, such as data collected from a socket.


Agent 434 may detect operations such as receiving calls and sending requests by application server 430, resource usage, and incoming packets. Agent 434 may receive data, process the data, for example by aggregating data into metrics, and transmit the data and/or metrics to controller 490. Agent 434 may perform other operations related to monitoring applications and application server 430 as discussed herein. For example, agent 434 may identify other applications, share business transaction data, aggregate detected runtime data, and other operations.


An agent may operate to monitor a node, tier of nodes, or other entity. A node may be a software program or a hardware component (e.g., memory, processor, and so on). A tier of nodes may include a plurality of nodes which may process a similar business transaction, may be located on the same server, may be associated with each other in some other way, or may not be associated with each other.


A language agent may be an agent suitable to instrument or modify, collect data from, and reside on a host. The host may be a Java, PHP, .Net, Node.JS, or other type of platform. Language agents may collect flow data as well as data associated with the execution of a particular application. The language agent may instrument the lowest level of the application to gather the flow data. The flow data may indicate which tier is communicating with which tier and on which port. In some instances, the flow data collected from the language agent includes a source IP, a source port, a destination IP, and a destination port. The language agent may report the application data and call chain data to a controller. The language agent may report the collected flow data associated with a particular application to a network agent.


A network agent may be a standalone agent that resides on the host and collects network flow group data. The network flow group data may include a source IP, destination port, destination IP, and protocol information for network flow received by an application on which network agent is installed. The network agent may collect data by intercepting and performing packet capture on packets coming in from one or more network interfaces (e.g., so that data generated/received by all the applications using sockets can be intercepted). The network agent may receive flow data from a language agent that is associated with applications to be monitored. For flows in the flow group data that match flow data provided by the language agent, the network agent rolls up the flow data to determine metrics such as TCP throughput, TCP loss, latency, and bandwidth. The network agent may then report the metrics, flow group data, and call chain data to a controller. The network agent may also make system calls at an application server to determine system information, such as for example a host status check, a network status check, socket status, and other information.


A machine agent, which may be referred to as an infrastructure agent, may reside on the host and collect information regarding the machine which implements the host. A machine agent may collect and generate metrics from information such as processor usage, memory usage, and other hardware information.


Each of the language agent, network agent, and machine agent may report data to the controller. Controller 490 may be implemented as a remote server that communicates with agents located on one or more servers or machines. The controller may receive metrics, call chain data and other data, correlate the received data as part of a distributed transaction, and report the correlated data in the context of a distributed application implemented by one or more monitored applications and occurring over one or more monitored networks. The controller may provide reports, one or more user interfaces, and other information for a user.


Agent 434 may create a request identifier for a request received by server 430 (for example, a request received by a client 405 or 415 associated with a user or another source). The request identifier may be sent to client 405 or mobile device 415, whichever device sent the request. In embodiments, the request identifier may be created when data is collected and analyzed for a particular business transaction.


Each of application servers 440, 450, and 460 may include an application and agents. Each application may run on the corresponding application server. Each of applications 442, 452, and 462 on application servers 440-460 may operate similarly to application 432 and perform at least a portion of a distributed business transaction. Agents 444, 454, and 464 may monitor applications 442-462, collect and process data at runtime, and communicate with controller 490. The applications 432, 442, 452, and 462 may communicate with each other as part of performing a distributed transaction. Each application may call any application or method of another virtual machine.


Asynchronous network machine 470 may engage in asynchronous communications with one or more application servers, such as application server 450 and 460. For example, application server 450 may transmit several calls or messages to an asynchronous network machine. Rather than communicate back to application server 450, the asynchronous network machine may process the messages and eventually provide a response, such as a processed message, to application server 460. Because there is no return message from the asynchronous network machine to application server 450, the communications among them are asynchronous.


Data stores 480 and 485 may each be accessed by application servers such as application server 460. Data store 485 may also be accessed by application server 450. Each of data stores 480 and 485 may store data, process data, and return queries received from an application server. Each of data stores 480 and 485 may or may not include an agent.


Controller 490 may control and manage monitoring of business transactions distributed over application servers 430-460. In some embodiments, controller 490 may receive application data, including data associated with monitoring client requests at client 405 and mobile device 415, from data collection server 495. In some embodiments, controller 490 may receive application monitoring data and network data from each of agents 412, 419, 434, 444, and 454 (also referred to herein as “application monitoring agents”). Controller 490 may associate portions of business transaction data, communicate with agents to configure collection of data, and provide performance data and reporting through an interface. The interface may be viewed as a web-based interface viewable by client device 492, which may be a mobile device, client device, or any other platform for viewing an interface provided by controller 490. In some embodiments, a client device 492 may directly communicate with controller 490 to view an interface for monitoring data.


Client device 492 may include any computing device, including a mobile device or a client computer such as a desktop, workstation or other computing device. Client computer 492 may communicate with controller 490 to create and view a custom interface. In some embodiments, controller 490 provides an interface for creating and viewing the custom interface as a content page, e.g., a web page, which may be provided to and rendered through a network browser application on client device 492.


Applications 432, 442, 452, and 462 may be any of several types of applications. Examples of applications that may implement applications 432-462 include a Java, PHP, .Net, Node.JS, and other applications.



FIG. 5 is a block diagram of a computer system 500 for implementing the present technology, which is a specific implementation of device 200 of FIG. 2 above. System 500 of FIG. 5 may be implemented in the contexts of the likes of clients 405, 492, network server 425, servers 430, 440, 450, 460, asynchronous network machine 470, and controller 490 of FIG. 4. (Note that the specifically configured system 500 of FIG. 5 and the customized device 200 of FIG. 2 are not meant to be mutually exclusive, and the techniques herein may be performed by any suitably configured computing device.)


The computing system 500 of FIG. 5 includes one or more processors 510 and memory 520. Main memory 520 stores, in part, instructions and data for execution by processor 510. Main memory 520 can store the executable code when in operation. The system 500 of FIG. 5 further includes a mass storage device 530, portable storage medium drive(s) 540, output devices 550, user input devices 560, a graphics display 570, and peripheral devices 580.


The components shown in FIG. 5 are depicted as being connected via a single bus 590. However, the components may be connected through one or more data transport means. For example, processor unit 510 and main memory 520 may be connected via a local microprocessor bus, and the mass storage device 530, peripheral device(s) 580, portable or remote storage device 540, and display system 570 may be connected via one or more input/output (I/O) buses.


Mass storage device 530, which may be implemented with a magnetic disk drive or an optical disk drive, is a non-volatile storage device for storing data and instructions for use by processor unit 510. Mass storage device 530 can store the system software for implementing embodiments of the present disclosure for purposes of loading that software into main memory 520.


Portable storage device 540 operates in conjunction with a portable non-volatile storage medium, such as a compact disk, digital video disk, magnetic disk, flash storage, etc. to input and output data and code to and from the computer system 500 of FIG. 5. The system software for implementing embodiments of the present disclosure may be stored on such a portable medium and input to the computer system 500 via the portable storage device 540.


Input devices 560 provide a portion of a user interface. Input devices 560 may include an alpha-numeric keypad, such as a keyboard, for inputting alpha-numeric and other information, or a pointing device, such as a mouse, a trackball, stylus, or cursor direction keys. Additionally, the system 500 as shown in FIG. 5 includes output devices 550. Examples of suitable output devices include speakers, printers, network interfaces, and monitors.


Display system 570 may include a liquid crystal display (LCD) or other suitable display device. Display system 570 receives textual and graphical information, and processes the information for output to the display device.


Peripherals 580 may include any type of computer support device to add additional functionality to the computer system. For example, peripheral device(s) 580 may include a modem or a router.


The components contained in the computer system 500 of FIG. 5 can include a personal computer, handheld computing device, telephone, mobile computing device, workstation, server, minicomputer, mainframe computer, or any other computing device. The computer can also include different bus configurations, networked platforms, multi-processor platforms, etc. Various operating systems can be used including Unix, Linux, Windows, Apple OS, and other suitable operating systems, including mobile versions.


When implementing a mobile device such as smart phone or tablet computer, the computer system 500 of FIG. 5 may include one or more antennas, radios, and other circuitry for communicating over wireless signals, such as for example communication using Wi-Fi, cellular, or other wireless signals.


Microservice Manager and Optimizer


As noted above, microservices have emerged as a major paradigm shift in the computing world. Rather than deploying monolithic applications, many companies are now choosing instead to develop scalable microservices that break the tasks of the application into individual runtimes, to handle the web service calls. In the context of the Java programming language, there are now multiple frameworks designed to support microservices. To do so, these platforms typically operate by exposing Representational State Transfer (REST) endpoints, which perform specific services. Microservices also typically use runtimes that are much smaller in terms of memory and much more dynamic than monolithic applications. Consequently, traditional APM solutions are not well suited for microservice frameworks, as their additional overhead may not be compatible with the resource constraints found in microservice frameworks.


The techniques herein, therefore, allow for APM solutions to be extended to microservice frameworks. In some aspects, the techniques herein introduce a lightweight and direct management solution for microservice frameworks that are also able to optimize the runtime for maximum performance and reliability.


Specifically, according to one or more embodiments described herein, an agent executed by a device detects an invocation that is made using Java reflection of a method associated with a microservice. The agent instruments the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice. The agent optimizes the invocation of the method associated with the microservice. The agent provides the one or more metrics regarding the microservice to a user interface.


Operationally, FIG. 6 illustrates a simplified architecture for a microservice framework with an agent, according to various embodiments. As shown, framework 600 may include the following components: a client 602, an API gateway 604, and n-number of microservices 606. Example microservice frameworks that follow this architecture include Spring Boot, DropWizard, Swagger, RestEasy, among others.


During operation, client 602, such as a mobile device, personal computer, or other networked device may send messages to API gateway 604, such as requests for information, command, etc. Typically, such messaging may take the form of HTTP(S) requests or responses that are processed by API gateway 604. For instance, client 602 may issue a REST request to API gateway 604 via a web browser or other app.


In general, API gateway 604 facilitates client 602 interacting with the application that comprises microservices 606a-606n. More specifically, in response to a message from client 602, API gateway 604 may call the corresponding microservice among microservices 606a-606n, such as by using REST. For instance, assume that the application that comprises microservices 606a-606n is an online retail application. In such a case, one microservice 606 may be a search service that allows client 602 to perform an inventory search, another microservice 606 may be a shopping cart service, a further microservice 606 may be a billing service, etc.


In the case of a Java application, a key feature of Java is reflection, which allows fields, interfaces, classes, and methods to be inspected at runtime. The benefit of this is that their names do not need to be known at compile time. In addition, methods can be invoked, new objects can be instantiated, and field values can be get/set, all using reflection. Accordingly, many Java-based applications that make use of microservices rely on Java reflection to invoke REST.


Unfortunately, Java reflection can have a significant impact on resource consumption, particularly as it relates to smaller JVMs as found in microservices. Notably, using reflection to invoke a method in a class (java.lang.reflect.Method.invoke) delegates this call to what is called a MethodAccessor. This MethodAccessor determines which class will ultimately make this call. The default MethodAccessor is a Java Native Interface (JNI) Call class (native), which is fairly slow.


To address the slowness of native reflection in Java, special JVM parameters exist which basically will change MethodAccessor to a much better performing Java implementation, once the number of invocations gets to a certain count. The difference is on the order approximately twenty times faster. However, this also comes at a big price in terms of memory, both PermGen and I-leap. The Java implementation creates one class (sunseflect.GeneratedMethodAccessor) per MethodAccessor, which causes new classes to be rapidly added that affect PermGen space (native memory) where classes are stored. In addition, there is an impact on heap space. This process is known as “inflation” and can be somewhat controlled via properties such as sunseflectinflationThreshold and sunseflect.noInflation. However, inflation cannot be is stopped entirely, nor is there a way to pick and choose which and how many “inflations” take place. In other words, the approach taken today is brute force and lacks intelligence as to whether inflation should take place or to distinguish between classes that should be inflated and those that should not.


To illustrate the invocation of REST via reflection in a typical framework, the following call stack was captured during a single REST call in Spring Boot. Note that the JNI Native call comes at the end and is calling the “slow” native reflection method. In certain embodiments, this may be upgraded to the faster, “direct” reflection method.

  • sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java)//Here is the “slow” JNI call
  • sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl. java:43) . // Here is the Delegate
  • java.lang.reflect.Method.invoke(Method.java:498). //Here is the standard Reflection Method Call
  • org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lam bda$static$0(ResourceMethodInvocationHandlerFactory.java:76) org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148) org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invok e(AbstractJavaResourceMethodDispatcher.java:191) org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$Type OutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:243) org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispat ch(AbstractJavaResourceMethodDispatcher.java:103) org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvok er.java:493) org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoke r.java:415) org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoke rjava:104) org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277) org.glassfish.jersey.internal.Errors$1.call(Errors.java:272) org.glassfish.jersey.internal.Errors$1.call(Errors.java:268) org.glassfish.jersey.internal.Errors.process(Errors.java:316) org.glassfish.jersey.internal.Errors.process(Errors.java:298) org.glassfish.jersey.internal.Errors.process(Errors.java:268) org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289) org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256) org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703) org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416) org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370) org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389) org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342) org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. java:231) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) org.apache.tomcat.webocket.server.WsFilter.doFilter(WsFilter.java:53) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. java:193) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFil ter.java:99) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.jav a:107) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. java:193) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEnco dingFilter.java:200) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.jav a:107) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain. java:193) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:7 70) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1 415) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) javalang.Thread.run(Thread.java:745)


According to various embodiments, the techniques herein introduce an agent 608 (e.g., an APM agent) that may be executed within microservice framework 600, such as by API gateway 604 and/or microservices 606a-606n. In some embodiments, as detailed below, agent 608 may function to instrument the REST calls made within framework 600, such as at the invocation of the call. In further embodiments, agent 608 may also be configured to optimize these invocations, so as to control which reflection calls are allowed to be “inflated.” Even for those reflection calls that are not allowed to be inflated, agent 608 may still optimize the invocation using a custom MethodHandles that takes advantage of Java's dynamic invoke instruction, which is still approximately three times faster than that of the native reflection call and will not consume memory like direct reflection does.


More specifically, in Java 7, Oracle introduced a new instruction, the first since Java's creation, called “invokedynamic.” This instruction is a game changer with respect to performance and benchmarks show that it provides performance on par with direct method calls, when used properly. Unfortunately, reflection used in microservice frameworks today does not make use of this new instruction, which opt to use traditional reflection, instead. Thus, using the MethodHandles class in place of the standard Method inflation can perform up to five times faster than that of the standard JNI Native MethodAccessor.


According to various embodiments, agent 608 may identify reflection invocations for REST endpoints and apply the following optimizations:

    • If the reflection invocation does not have priority, agent 608 may ensure that the MethodHandle call is made, instead of the JNI native call. This results in a speed enhancement of approximately three to five times that of the native call.
    • If the reflection invocation does have priority, agent 608 may ensure that it uses the direct reflection call. This results in a speed enhancement of approximately twenty times that of the native call, but at the cost of greater memory consumption.
  • The key to the above optimization is that agent 608 now controls how many reflection inflations occur and which classes uses them. Even for those that are not inflated, the above approach still replaces the native reflection approach with MethodHandle calls, still resulting in a speed increase. This is the best of both worlds using a much faster default, automatically setting the REST endpoints and designed packages to the maximum priority and limit how many of these classes can be generated, so that running out of memory does not become an issue.


In one embodiment, agent 608 may use machine learning to optimize the efficiency of the reflection calls and prevent many bottlenecks due to reflection inflation. Indeed, machine learning can be used to select which reflection calls are allowed to be inflated using direct reflection. In general, machine learning is concerned with the design and the development of techniques that receive empirical data as input (e.g., telemetry data regarding traffic in the network) and recognize complex patterns in the input data. For example, some machine learning techniques use an underlying model M, whose parameters are optimized for minimizing the cost function associated to M, given the input data. For instance, in the context of classification, the model M may be a straight line that separates the data into two classes (e.g., labels) such that M=a*x+b*y+c and the cost function is a function of the number of misclassified points. The learning process then operates by adjusting the parameters a,b,c such that the number of misclassified points is minimal. After this optimization/learning phase, the model M can be used to evaluate new data points, such as new reflection calls within the application. Often, M is a statistical model, and the cost function is inversely proportional to the likelihood of M, given the input data.


Example machine learning techniques that agent 608 can employ to control which reflection call is made may include, but are not limited to, nearest neighbor (NN) techniques (e.g., k-NN models, replicator NN models, etc.), statistical techniques (e.g., Bayesian networks, etc.), clustering techniques (e.g., k-means, mean-shift, etc.), neural to networks (e.g., reservoir networks, artificial neural networks, etc.), support vector machines (SVMs), logistic or other regression, Markov models or chains, principal component analysis (PCA) (e.g., for linear models), multi-layer perceptron (MLP) artificial neural networks (ANNs) (e.g., for non-linear models), replicating reservoir networks (e.g., for non-linear models, typically for time series), random forest classification, or the like.


In addition to optimizing the invocation of a particular method, agent 608 may also instrument the invocation, to capture one or more metrics regarding the corresponding microservice 606. Note that REST endpoints are typically invoked in a microservice framework using the same class/method calls for all endpoints: java.lang.Method.invoke. Thus, in some embodiments, agent 608 may instrument java.lang.Method.invoke, to capture the one or more metrics. Doing so allows agent 608 to instrument only a single method. This is in contrast to traditional APM agents that typically instrument the actual REST endpoint methods, resulting in every single REST endpoint requiring instrumentation and resulting in more memory consumption.


As would be appreciated, java.lang.Method.invoke may also be used to make non-REST calls, as well. To differentiate between REST calls and non-REST calls, agent 608 may scan the classes as loaded for the REST endpoint annotation and storing the names. Then, when a reflection call takes place, agent 608 can use the stored this to determine whether a REST endpoint is being invoked. If so, agent 608 may instrument the invocation, in addition to optimizing the reflection that it uses.


By intercepting the inbound call to the “invoke” method, agent 608 can instrument the invocation and optimize it by executing the following, according to the above optimizations:

    • If it is a non-priority package, execute MethodHandle.invoke( . . . ) instead of the native NativeMethodAccessorImpl.invoke0( . . . ) call.
    • If it is a priority package, execute the NativeMethodAccessor logic, but with a threshold of zero set, so that it will immediately create the Java MethodAccessor call on the very first usage.


As would be appreciated, most APM agents are designed to cache and send metrics at periodic intervals to a backend. There are various reasons why this is done—one of the most important is that it's difficult to connect into an agent on an application because of firewalls. However, in a typical microservice environment, there is little room for additional third-party libraries used to send metrics because the microservice manager does not use third party libraries at all. Instead, the network connections inbound, and outbound use “built in” JDK classes that are already loaded. Accordingly, in some embodiments, remote access to agent 608 may be achieved from outside the site using a technique where the agent connects to a gateway proxy via WebSocket and the user is able to access a “light” HTML web server on agent 608 itself for diagnostics and metrics.


A prototype agent was created, to illustrate the efficacy of the techniques herein. FIG. 7 illustrates an example folder structure 700 for the prototype agent, in some embodiments. As shown, the agent can be attached in one of two ways:

    • Dynamic Attach (on demand): /attach-micro-manager.sh PID
    • Static Attach (in the startup script): adding-javaagent:micro-manager/lib/microManagerAgentEntry.jar



FIGS. 8A-8D illustrate examples output of the prototype implementing the techniques herein. More specifically, FIG. 8A illustrates an example 800 of the execution of a REST endpoint with a ten second wait. For the prototype, the prototype agent was loaded during startup of Spring Boot. Then, an error was created, as shown in example 810 in FIG. 8B.



FIG. 8C illustrates an example 820 of the information captured by the prototype agent. Notably, the endpoint is “hello.RestComponents.perform” and two calls are made, one of which is an error (“A Rest Error has occurred”). The calls allocated 122,400 bytes and 5.3 ms of latency was observed over ten seconds. Note that the wait time is almost identical to the latency, so the time was spent waiting and not working. Looking at the sampling, the time spent waiting was in a Thread.sleep call as it was the current method 189 times (almost all of the time). The EndpointStackTrace was also captured.


Interestingly, there were 270 reflection classes that were optimized to use MethodHandles “dynamicinvoke” versus the native JVM, which appeared in the log as is follows:

    • Mon Feb. 17 16:27:12 CST 2020: Discovered Native Reflection instance (270) sun.reflect.NativeMethodAccessorlmpl@1457093 for method public abstract long com.sun.management.ThreadMXBean.getThreadAllocatedBytes(long)



FIG. 8D illustrates an example 830 of the memory usage by the overall JVM. As far as memory consumption, the prototype agent only added 10 mb to the JVM.


In closing, example simplified procedure for instrumenting and optimizing a microservice-based application, in accordance with one or more embodiments described herein. For example, a non-generic, specifically configured device (e.g., device 200) may perform procedure 900 by executing stored instructions (e.g., process 248, such as a monitoring process) that includes an agent configured to manage and optimize microservice calls in a microservice framework. As shown, procedure 900 starts at step 905 and continues on to step 910 where, as described in greater detail above, the agent may detect an invocation that is made using Java reflection of a method associated with a microservice. For instance, the agent may detect the use of java.lang.Method.invoke or another call that relies on Java reflection.


At step 915, as detailed above, the agent may instrument the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice. For instance, the agent may instrument javalang.Method.invoke or the other invocation of the method associated with the microservice, to capture one or more metrics. Such metrics may be indicative of a resource consumption by the microservice, a response time of the microservice, an availability of the microservice, combinations thereof, or the like. To avoid instrumenting certain calls that also use this type of invocation, such as non-REST calls, the agent may differentiate these calls by scanning the classes as loaded.


At step 920, the agent may optimize the invocation of the method associated with the microservice, as described in greater detail above. In various embodiments, the agent may do so by evaluating whether the reflection call is attempting to use native reflection calls and/or a priority associated with the package. For instance, the agent may replace a NativeMethodAccessorImpl.invoke0( . . . ) call with a Java MethodAccessor call, if the package has priority, in some embodiments. In a further embodiment, the agent may replace such a native call with a MethodHandle.invoke( . . . ) call for a non-priority package, which will still result in fast execution without an increase in memory consumption.


At step 925, as detailed above, the agent may provide the one or more metrics regarding the microservice to a user interface. In some cases, the agent may send the metrics to a backend system for forwarding to the user interface. In other cases, the agent itself may include a lightweight HTML web server and provide the metric(s) to a display or other user interface of a client operated by an interested party.


The simplified procedure 900 may then end in step 930, notably with the ability to continue ingesting and processing data. Other steps may also be included generally within procedure 900.


It should be noted that while certain steps within procedure 900 may be optional as described above, the steps shown in FIG. 9 are merely examples for illustration, and certain other steps may be included or excluded as desired. Further, while a particular order of the steps is shown, this ordering is merely illustrative, and any suitable arrangement of the steps may be utilized without departing from the scope of the embodiments herein.


The techniques described herein, therefore, provide for a microservice manager and optimizer. In particular, as noted above the techniques herein introduce a microservice manager and optimizer that can allow for APM solutions to be extended to microservice frameworks, introducing a lightweight and direct management solution for microservice frameworks that are also able to optimize the runtime for maximum performance and reliability.


Illustratively, the techniques described herein may be performed by hardware, software, and/or firmware, such as in accordance with the illustrative application is monitoring process 248, or another Java agent, which may include computer executable instructions executed by the processor 220 to perform functions relating to the techniques described herein, e.g., in conjunction with corresponding processes of other devices in the computer network as described herein (e.g., on network agents, controllers, computing devices, servers, etc.).


According to the embodiments herein, a method herein may comprise: detecting, by an agent executed by a device, an invocation that is made using Java reflection of a method associated with a microservice; instrumenting, by the agent, the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice; optimizing, by the agent, the invocation of the method associated with the microservice; and providing, by the agent, the one or more metrics regarding the microservice to a user interface.


In one embodiment, the method associated with the microservice is Representational State Transfer (REST)-based. In another embodiment, detecting the invocation of the method associated with the microservice comprises determining whether the method is a REST method, by evaluating a class associated with the method associated with the microservice. In a further embodiment, optimizing the invocation of the method associated with the microservice comprises selecting a reflection call for the invocation, based on a priority associated with the method associated with the microservice. In yet another embodiment, the reflection call selected for the invocation is a dynamic invoke call, and optimizing the invocation of the method associated with the microservice further comprises replacing a native reflection call of the invocation with the dynamic invoke call. In another embodiment, the reflection call for the invocation is selected using a machine learning model trained to reduce resource consumption by the invocation. In an additional embodiment, optimizing the invocation of the method associated with the microservice comprises preventing the invocation of the method associated with the microservice from using a direct reflection call. In a further embodiment, the one or more metrics regarding the microservice is provided to a user interface via a webserver of the agent. In another embodiment, the one or more metrics associated with the microservice are indicative of at least one of: an availability of the microservice or a response time of the microservice.


According to the embodiments herein, a tangible, non-transitory, computer-readable medium storing program instructions that cause a device to execute a process comprising: detecting, by an agent executed by the device, an invocation that is made using Java reflection of a method associated with a microservice; instrumenting, by the agent, the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice; optimizing, by the agent, the invocation of the method associated with the microservice; and providing, by the agent, the one or more metrics regarding the microservice to a user interface.


Further, according to the embodiments herein an apparatus is disclosed comprising: one or more network interfaces; a processor coupled to the one or more network interfaces and configured to execute one or more processes; and a memory configured to store a process that is executable by the processor, the process when executed configured to: detect an invocation that is made using Java reflection of a method associated with a microservice; instrument the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice; optimize the invocation of the method associated with the microservice; and provide the one or more metrics regarding the microservice to a user interface.


While there have been shown and described illustrative embodiments above, it is to be understood that various other adaptations and modifications may be made within the scope of the embodiments herein. For example, while certain embodiments are described herein with respect to certain types of networks in particular, the techniques are not limited as such and may be used with any computer network, generally, in other embodiments. Moreover, while specific technologies, protocols, and associated devices have been shown, such as Java, TCP, IP, and so on, other suitable technologies, protocols, and associated devices may be used in accordance with the techniques described above. In addition, while certain devices are shown, and with certain functionality being performed on certain devices, other suitable devices and process locations may be used, accordingly. That is, the embodiments have been shown and described herein with relation to specific network configurations (orientations, topologies, protocols, terminology, processing locations, etc.). However, the embodiments in their broader sense are not as limited, and may, in fact, be used with other types of networks, protocols, and configurations.


Moreover, while the present disclosure contains many other specifics, these should not be construed as limitations on the scope of any embodiment or of what may be claimed, but rather as descriptions of features that may be specific to particular embodiments of particular embodiments. Certain features that are described in this document in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub-combination. Further, although features may be described above as acting in certain combinations and even initially claimed as such, one or more features from a claimed combination can in some cases be excised from the combination, and the claimed combination may be directed to a sub-combination or variation of a sub-combination.


For instance, while certain aspects of the present disclosure are described in terms of being performed “by a server” or “by a controller,” those skilled in the art will appreciate that agents of the application intelligence platform (e.g., application agents, network agents, language agents, etc.) may be considered to be extensions of the server (or controller) operation, and as such, any process step performed “by a server” need not be limited to local processing on a specific server device, unless otherwise specifically noted as such. Furthermore, while certain aspects are described as being performed “by an agent” or by particular types of agents (e.g., application agents, network agents, etc.), the techniques may be generally applied to any suitable software/hardware configuration (libraries, modules, etc.) as part of an apparatus or otherwise.


Similarly, while operations are depicted in the drawings in a particular order, this is should not be understood as requiring that such operations be performed in the particular order shown or in sequential order, or that all illustrated operations be performed, to achieve desirable results. Moreover, the separation of various system components in the embodiments described in the present disclosure should not be understood as requiring such separation in all embodiments.


The foregoing description has been directed to specific embodiments. It will be apparent, however, that other variations and modifications may be made to the described embodiments, with the attainment of some or all of their advantages. For instance, it is expressly contemplated that the components and/or elements described herein can be implemented as software being stored on a tangible (non-transitory) computer-readable medium (e.g., disks/CDs/RAM/EEPROM/etc.) having program instructions executing on a computer, hardware, firmware, or a combination thereof. Accordingly, this description is to be taken only by way of example and not to otherwise limit the scope of the embodiments herein. Therefore, it is the object of the appended claims to cover all such variations and modifications as come within the true intent and scope of the embodiments herein.

Claims
  • 1. A method comprising: detecting, by an agent executed by a device, an invocation that is made using Java reflection of a method associated with a microservice;instrumenting, by the agent, the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice;optimizing, by the agent, the invocation of the method associated with the microservice by selecting a reflection call among a plurality of reflection calls for the invocation of the method associated with the microservice based on a priority associated with the method associated with the microservice; andproviding, by the agent, the one or more metrics regarding the microservice to a user interface.
  • 2. The method as in claim 1, wherein the method associated with the microservice is Representational State Transfer (REST)-based.
  • 3. The method as in claim 2, wherein detecting the invocation of the method associated with the microservice comprises: determining whether the method is a REST method, by evaluating a class associated with the method associated with the microservice.
  • 4. The method as in claim 1, wherein the reflection call selected for the invocation is a dynamic invoke call, and wherein optimizing the invocation of the method associated with the microservice further comprises: replacing a native reflection call of the invocation with the dynamic invoke call.
  • 5. The method as in claim 1, wherein the reflection call for the invocation is selected using a machine learning model trained to reduce resource consumption by the invocation.
  • 6. The method as in claim 1, wherein optimizing the invocation of the method associated with the microservice comprises: preventing the invocation of the method associated with the microservice from using a direct reflection call.
  • 7. The method as in claim 1, wherein the one or more metrics regarding the microservice is provided to a user interface via a webserver of the agent.
  • 8. The method as in claim 1, wherein the one or more metrics associated with the microservice are indicative of at least one of: an availability of the microservice or a response time of the microservice.
  • 9. A tangible, non-transitory, computer-readable medium storing program instructions that cause a device to execute a process comprising: detecting, by an agent executed by the device, an invocation that is made using Java reflection of a method associated with a microservice;instrumenting, by the agent, the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice;optimizing, by the agent, the invocation of the method associated with the microservice by selecting a reflection call among a plurality of reflection calls for the invocation of the method associated with the microservice based on a priority associated with the method associated with the microservice; andproviding, by the agent, the one or more metrics regarding the microservice to a user interface.
  • 10. The computer-readable medium as in claim 9, wherein the method associated with the microservice is Representational State Transfer (REST)-based.
  • 11. The computer-readable medium as in claim 10, wherein detecting the invocation of the method associated with the microservice comprises: determining whether the method associated with the microservice is a REST method, by evaluating a class associated with the method.
  • 12. The computer-readable medium as in claim 9, wherein the reflection call for the invocation is selected using a machine learning model trained to reduce resource consumption by the invocation.
  • 13. The computer-readable medium as in claim 9, wherein the reflection call selected for the invocation is a dynamic invoke call, and wherein optimizing the invocation of the method associated with the microservice further comprises: replacing a native reflection call of the invocation with the dynamic invoke call.
  • 14. The computer-readable medium as in claim 9, wherein optimizing the invocation of the method comprises: preventing the invocation of the method associated with the microservice from using a direct reflection call.
  • 15. The computer-readable medium as in claim 9, wherein the one or more metrics regarding the microservice associated with the microservice is provided to the user interface via a webserver of the agent.
  • 16. The computer-readable medium as in claim 9, wherein the one or more metrics are indicative of at least one of: an availability of the microservice or a response time of the microservice.
  • 17. An apparatus, comprising: one or more network interfaces;a processor coupled to the one or more network interfaces and configured to execute one or more processes; anda memory configured to store a process that is executable by the processor, the process when executed configured to: detect an invocation that is made using Java reflection of a method associated with a microservice;instrument the invocation of the method associated with the microservice, to capture one or more metrics regarding the microservice;optimize the invocation of the method associated with the microservice by selecting a reflection call among a plurality of reflection calls for the invocation of the method associated with the microservice based on a priority associated with the method associated with the microservice; andprovide the one or more metrics regarding the microservice to a user interface.
  • 18. The apparatus as in claim 17, wherein the method associated with the microservice is Representational State Transfer (REST)-based.
US Referenced Citations (27)
Number Name Date Kind
9043768 Öhrström May 2015 B2
9231819 Pasternak Jan 2016 B2
9875086 Anderson et al. Jan 2018 B1
10178045 Kumar Jan 2019 B2
10230571 Rangasamy Mar 2019 B2
10462031 Nataraj Oct 2019 B1
10545738 Jaeger Jan 2020 B1
10574736 Kulp et al. Feb 2020 B2
10659338 Nataraj May 2020 B1
10684940 Kayal Jun 2020 B1
10764244 Mestery Sep 2020 B1
11038763 Cui Jun 2021 B1
11057271 Garipally Jul 2021 B2
11063847 Wang Jul 2021 B2
11064425 Cui Jul 2021 B1
20180198845 Kulp Jul 2018 A1
20180322185 Patel Nov 2018 A1
20180336073 Kolachala Nov 2018 A1
20190130045 Jindal May 2019 A1
20190132377 Hulick, Jr May 2019 A1
20190303266 Bonnell Oct 2019 A1
20200065497 Suess Feb 2020 A1
20200133795 Rhodes Apr 2020 A1
20200252262 Cao Minh Aug 2020 A1
20200401447 Xiao Dec 2020 A1
20210149648 Velammal May 2021 A1
20210157906 Shaon May 2021 A1
Non-Patent Literature Citations (10)
Entry
Anshuiitk, “Excessive Full Garbage Collection : Reflection”, online: http://anshuiitk.blogspot.com/2010/11/excessive-full-garbage-collection.html?m=1, Nov. 2010 [printed Jun. 2020], 14 pages, Blogger.
Belyaev, A, “Think Twice Before Using Reflection”, online: https://dzone.com/articles/think-twice-before-using-reflection, Apr. 2019 [printed Jun. 2020], 10 pages, DZone.
Buck, D., “Inflation System Properties”, online: https://blogs.oracle.com/buck/inflation-system-properties, Feb. 2014 [printed Jun. 2020], 5 pages, Oracle.
Forbes, E., “Microservices in Java? Never.”, online: https://codeburst.io/microservices-in-java-never-a7f3a2540dbb, Oct. 2017 [printed Jun. 2020], 6 pages, Medium.
Katleman, “OpenJDK / jdk8 / jdk8 / jdk”, online: http://hg.openjdk.java.net/jdk8/jdk8/jdk/file/687fd7c7986d/src/share/classes/sun/reflect/NativeMethodAccessorImpl.java, Mar. 2014 [printed Jun. 2020], 3 pages, Oracle.
“Class Method”, online: https://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.html, Java Platform Standard Ed. 8, Jan. 2012 [printed Jun. 2020], 18 pages, Oracle.
“Class MethodHandles”, online: https://docs.oracle.com/javase/8/docs/api/java/lang/invoke/MethodHandles.html, Java Platform Standard Ed. 8, Jan. 2012 [printed Jun. 2020], 28 pages, Oracle.
“How to Avoid the Generation of sun.reflect.GeneratedMethodAccessor Classes”, online: https://support.oracle.com/knowledge/Middleware/1669883_1 .html#SYMPTOM, Oct. 2019 [printed Jun. 2020], 2 pages, Oracle.
“Support Forum”, online: https://www.ibm.com/mysupport/s/forumshome?language=en_US, Jun. 2020, 8 pages, IBM Support.
“Java 8 Metaspace: OutOfMemoryError: Dealing with reflection Inflation”, online: https://stackoverflow.com/questions/44932132/java-8-metaspace-outofmemoryerror-dealing-with-reflection-inflation, 2017 [printed Jun. 2020], 4 pages, Stack Overflow.
Related Publications (1)
Number Date Country
20220006854 A1 Jan 2022 US