# Blow-up or Grow-up for the threshold solutions to the nonlinear Schrödinger
equation

Stephen Gustafson  University of British Columbia, 1984 Mathematics Rd.,
Vancouver, Canada V6T1Z2<EMAIL_ADDRESS>and  Takahisa Inui  Department
of Mathematics, Graduate School of Science, Osaka University, Toyonaka, Osaka,
Japan 560-0043.
University of British Columbia, 1984 Mathematics Rd., Vancouver, Canada
V6T1Z2<EMAIL_ADDRESS>
###### Abstract.

We consider the nonlinear Schrödinger equation with $L^{2}$-supercritical and
$H^{1}$-subcritical power type nonlinearity. Duyckaerts and Roudenko [8] and
Campos, Farah, and Roudenko [3] studied the global dynamics of the solutions
with same mass and energy as that of the ground state. In these papers, finite
variance is assumed to show the finite time blow-up. In the present paper, we
remove the finite-variance assumption and prove a blow-up or grow-up result.

###### Key words and phrases:

nonlinear Schrödinger equation, blow-up, grow-up

###### 2020 Mathematics Subject Classification:

35Q55,35B44 etc.

###### Contents

  1. 1 Introduction
    1. 1.1 Background
    2. 1.2 Main result
    3. 1.3 Idea of the proof
  2. 2 Preliminaries
    1. 2.1 Variational structure
    2. 2.2 Localized virial identity
    3. 2.3 Strichartz norms
  3. 3 Modulation
  4. 4 Profile decomposition
  5. 5 Proof of Main Theorem
    1. 5.1 Compactness of the uniformly bounded solution
    2. 5.2 Finite variance through convergence

##  1\. Introduction

###  1.1. Background

We consider the following nonlinear Schrödinger equation:

$\displaystyle\left\\{\begin{aligned} &i\partial_{t}u+\Delta
u+|u|^{p-1}u=0,&(t,x)\in I\times\mathbb{R}^{d},\\\
&u(0,x)=u_{0}(x),&x\in\mathbb{R}^{d},\end{aligned}\right.$ (NLS)

where $d\in\mathbb{N}$, $1+4/d<p<(d+2)/(d-2)$. Here, we regard $(d+2)/(d-2)$
as $\infty$ when $d=1,2$. The nonlinearity is called $L^{2}$-supercritical and
$H^{1}$-subcritical. The initial value problem is locally well-posed in
$H^{1}(\mathbb{R}^{d})$ (see [11] and the standard text books [4, 26, 20]). We
also know that the blow-up criterion holds. That is, if the forward (resp.
backward) maximal existence time $T_{\max}$ (resp. $T_{\min}$) is finite then
$\|\nabla u(t)\|_{L^{2}}$ diverges at $t=T_{\max}$ (resp. $t=T_{\min}$).
Moreover, the mass $M$, energy $E$, and momentum $P$, given by

$\displaystyle M(u)$ $\displaystyle=\|u\|_{L^{2}}^{2},$ $\displaystyle E(u)$
$\displaystyle=\frac{1}{2}\|\nabla
u\|_{L^{2}}^{2}-\frac{1}{p+1}\|u\|_{L^{p+1}}^{p+1},$ $\displaystyle P(u)$
$\displaystyle=\operatorname{Im}\int_{\mathbb{R}^{d}}\overline{u(x)}\nabla
u(x)dx$

are conserved by the flow. In the study of the global dynamics, the ground
state solution $e^{it}Q(x)$ plays a crucial role. Here, $Q$ is the least-
energy radial, positive solution to the elliptic equation:

$\displaystyle-\Delta Q+Q-Q^{p}=0\text{ in }\mathbb{R}^{d}.$

Since pioneering work by Kenig and Merle [18], many researchers have studied
(NLS) from the viewpoint of global dynamics. We summarize the global dynamics
of solutions below the ground state:

######  Theorem (Global dynamics below the ground state).

Let $u_{0}\in H^{1}(\mathbb{R}^{d})$ satisfy
$M(u_{0})^{\frac{1-s_{c}}{s_{c}}}E(u_{0})<M(Q)^{\frac{1-s_{c}}{s_{c}}}E(Q)$,
where $s_{c}:=\frac{d}{2}-\frac{2}{p-1}$.

  1. (1)

If $\|u_{0}\|_{L^{2}}^{1-s_{c}}\|\nabla
u_{0}\|_{L^{2}}^{s_{c}}<\|Q\|_{L^{2}}^{1-s_{c}}\|\nabla Q\|_{L^{2}}^{s_{c}}$,
then the solution $u$ exists for $t\in\mathbb{R}$, and scatters in both time
directions.

  2. (2)

If $\|u_{0}\|_{L^{2}}^{1-s_{c}}\|\nabla
u_{0}\|_{L^{2}}^{s_{c}}>\|Q\|_{L^{2}}^{1-s_{c}}\|\nabla Q\|_{L^{2}}^{s_{c}}$,
then the solution $u$ blows up or grows up in both time directions.

######  Remark 1.1.

  1. (1)

$\|u_{0}\|_{L^{2}}^{1-s_{c}}\|\nabla
u_{0}\|_{L^{2}}^{s_{c}}=\|Q\|_{L^{2}}^{1-s_{c}}\|\nabla Q\|_{L^{2}}^{s_{c}}$
does not occur since we assume
$M(u_{0})^{\frac{1-s_{c}}{s_{c}}}E(u_{0})<M(Q)^{\frac{1-s_{c}}{s_{c}}}E(Q)$.

  2. (2)

We say that $u$ grows up in positive time if $u$ exists at least on
$[0,\infty)$ and $\limsup_{t\to\infty}\|\nabla u(t)\|_{L^{2}}=\infty$.

  3. (3)

In the second statement, we have four possibilities. For example, $u$ blows up
in finite positive time and grows up in the negative time direction.

  4. (4)

Martel and Raphaël [21] showed existence of a grow-up solution for the
$L^{2}$-critical NLS on $\mathbb{R}^{2}$ (i.e., $p=3$). However, it is still
an open problem whether a grow-up solution to (NLS) exists.

Holmer and Roudenko [16] showed the scattering part for 3d cubic NLS in the
radial setting. The radial assumption was removed by Duyckaerts, Holmer, and
Roudenko [7]. The blow-up or grow-up part for 3d cubic NLS is obtained by
Holmer and Roudenko [17]. Akahori and Nawa [1] and Guevara [13] proved both
scattering and blow-up or grow-up results for (NLS) (i.e. for general power
and dimension). Fang, Xie, and Cazenave [10] showed the scattering for (NLS).
Guo [14] obtained the blow-up or grow-up result for (NLS). Their proofs of
scattering rely on a concentration compactness and rigidity argument, which
was developed by Kenig and Merle [18]. Dodson and Murphy [5] give another
proof of the scattering part for 3d cubic NLS in the radial setting. They used
an interaction Morawetz estimate and Tao’s scattering criterion ([25]). They
removed the radial assumption in [6]. See also [2, 15].

While the global behavior of solutions below the ground state is of only two
types, i.e., scattering or blow-up (or grow-up), another global behavior
appears in the threshold case – there exist solutions converging to the ground
state:

######  Theorem (Existence of special solutions on the threshold).

There exist two radial solutions $Q^{\pm}(t)$ to (NLS) in
$H^{1}(\mathbb{R}^{d})$ such that

  * •

$M(Q^{\pm})=M(Q)$, $E(Q^{\pm})=E(Q)$, $Q^{\pm}$ exist at least on
$[0,\infty)$, and there exist $C,c>0$ such that

$\displaystyle\|Q^{\pm}(t)-e^{it}Q\|_{H^{1}}\leq Ce^{-ct}$

for $t\geq 0$,

  * •

$\|\nabla Q^{+}(0)\|_{L^{2}}>\|\nabla Q\|_{L^{2}}$ and $Q^{+}$ blows up in
finite negative time,

  * •

$\|\nabla Q^{-}(0)\|_{L^{2}}<\|\nabla Q\|_{L^{2}}$ and $Q^{-}$ exists globally
and scatters backward in time.

Moreover, we know the global dynamics on the threshold:

######  Theorem (Global dynamics of threshold solutions).

Let $u_{0}\in H^{1}(\mathbb{R}^{d})$ satisfy
$M(u_{0})^{\frac{1-s_{c}}{s_{c}}}E(u_{0})=M(Q)^{\frac{1-s_{c}}{s_{c}}}E(Q)$.

  1. (1)

If $\|u_{0}\|_{L^{2}}^{1-s_{c}}\|\nabla
u_{0}\|_{L^{2}}^{s_{c}}<\|Q\|_{L^{2}}^{1-s_{c}}\|\nabla Q\|_{L^{2}}^{s_{c}}$,
then the solution $u$ exists on $\mathbb{R}$. Moreover, either $u$ scatters in
both directions or $u=Q^{-}$ up to symmetries of the equation.

  2. (2)

If $\|u_{0}\|_{L^{2}}^{1-s_{c}}\|\nabla
u_{0}\|_{L^{2}}^{s_{c}}=\|Q\|_{L^{2}}^{1-s_{c}}\|\nabla Q\|_{L^{2}}^{s_{c}}$,
then $u=e^{it}Q$ up to symmetries of the equation.

  3. (3)

We assume that $u_{0}$ is radial when $d\geq 2$ or $|x|u_{0}\in L^{2}$. If
$\|u_{0}\|_{L^{2}}^{1-s_{c}}\|\nabla
u_{0}\|_{L^{2}}^{s_{c}}>\|Q\|_{L^{2}}^{1-s_{c}}\|\nabla Q\|_{L^{2}}^{s_{c}}$,
then either the solution $u$ blows up in finite positive and negative time or
$u=Q^{+}$ up to symmetries of the equation.

######  Remark 1.2.

The case $d=1$ with radial (even) symmetry is not included in part (3).

These result were shown by Duyckaerts and Roudenko [8] for 3d cubic NLS.
Recently, these were extended to general dimensions and powers by Campos,
Farah, and Roudenko [3]. Global dynamics above the ground state were studied
by Nakanishi and Schlag [22], but we do not pursue that direction here.

We are interested in the blow-up result on the threshold. While the blow-up or
grow-up result without finite variance is known below the ground state, the
result without finite variance (or radial symmetry) was not known at the
threshold. In the present paper we remove this additional assumption.

###  1.2. Main result

We define the virial functional $K$ by

$\displaystyle
K(\varphi):=\|\nabla\varphi\|_{L^{2}}^{2}-\frac{d(p-1)}{2(p+1)}\|\varphi\|_{L^{p+1}}^{p+1}.$

######  Theorem 1.1.

Let $u$ be a solution to (NLS) satisfying

$\displaystyle M(u_{0})=M(Q),\;E(u_{0})=E(Q),\;K(u_{0})<0.$ (MEN)

Then $u$ must satisfy one of the following:

  1. (1)

$u$ blows up in both time directions,

  2. (2)

$u$ blows up in positive time and grows up in negative time,

  3. (3)

$u$ blows up in negative time and grows up in positive time,

  4. (4)

$u$ grows up in both time directions,

  5. (5)

$u=Q^{+}$ up to symmetries.

######  Remark 1.3.

The negativity of the virial functional is equivalent to $\|\nabla
Q\|_{L^{2}}<\|u\|_{L^{2}}$ under the mass-energy condition
$M(u)=M(Q),E(u)=E(Q)$.

By scaling and the variational structure, we get the following statement as a
corollary of Theorem 1.1 (see [3, Remark 1.6]).

######  Corollary 1.2.

Let $u$ be the solution satisfying
$M(u_{0})^{\frac{1-s_{c}}{s_{c}}}E(u_{0})=M(Q)^{\frac{1-s_{c}}{s_{c}}}E(Q)$
and $\|u_{0}\|_{L^{2}}^{1-s_{c}}\|\nabla
u_{0}\|^{s_{c}}>\|Q\|_{L^{2}}^{1-s_{c}}\|\nabla Q\|^{s_{c}}$. Then the
conclusion of Theorem 1.1 holds.

###  1.3. Idea of the proof

The virial identity

$\displaystyle\frac{d^{2}}{dt^{2}}\left(\int_{\mathbb{R}^{d}}|x|^{2}|u(t,x)|^{2}dx\right)=8K(u(t))$

is very useful for showing blow-up. Glassey [12] used it to show that
solutions with negative energy blow up in finite time if the initial data is
of finite variance. To remove the finite variance assumption in the use of the
virial identity, a localized virial identity

$\displaystyle\frac{d^{2}}{dt^{2}}\left(\int_{\mathbb{R}^{d}}\varphi_{R}(x)|u(t,x)|^{2}dx\right)=8K(u(t))+A_{R}(u(t))$

is used, where $\varphi_{R}\in C_{0}^{\infty}$ satisfies $\varphi(x)=|x|^{2}$
for $|x|\leq R$ and $A_{R}$ is an error term. Under the radially symmetric
assumption, by using this localized virial identity and the radial Sobolev
inequality to control the error term, Ogawa and Tsutsumi [23] proved blow-up
of solutions with negative energy when $d\geq 2$. Ogawa and Tsutsumi also
showed blow-up for 1d quintic NLS without the radial assumption by using a
localized virial identity and scaling argument in [24]. Their proof relies on
the $L^{2}$-critical nonlinearity. As far as the authors know, there is no
finite time blow-up result for even solutions of (NLS) in the one dimensional
case. Akahori and Nawa [1] gave a proof of blow-up or grow-up under the
assumption $\sup_{t>0}K(u(t))<0$, which holds under the mass-energy condition
$M(u_{0})^{\frac{1-s_{c}}{s_{c}}}E(u_{0})<M(Q)^{\frac{1-s_{c}}{s_{c}}}E(Q)$
and negativity of $K(u_{0})$ (see also [9]). They derived a contradiction by
controlling the error term in the localized virial identity assuming the
uniform boundedness $\sup_{t>0}\|\nabla u(t)\|_{L^{2}}<\infty$. However, this
argument does not work on the threshold. Indeed, we have the possibility that
$K(u(t))\to 0$ as $t\to\infty$. To overcome this difficulty, we use a
concentration compactness argument, obtained by Keraani [19] and developed by
Kenig and Merle [18] to show the scattering result. The method of application
of the concentration compactness argument to show blow-up was designed by
Holmer and Roudenko [17] in the study of 3d cubic NLS, and was extended to
general dimensions and powers by Guevara [13] and Guo [14]. By the
concentration compactness argument, we can show that the orbit of the global-
in-time uniformly bounded solution $u$ with negative $K$ is compact in
$H^{1}$. More precisely, there exists $X:(0,\infty)\to\mathbb{R}^{d}$ such
that $\\{u(t,\cdot-X(t)):t>0\\}$ is precompact in $H^{1}(\mathbb{R}^{d})$. In
the below-threshold case, we have $\sup_{t>0}K(u(t))<0$, the error term is
controlled by the precompactness, and we get a contradiction. On the
threshold, $K(u(t))\to 0$ may happen. We apply a modulation argument to show
that $u(t)\to e^{i\theta_{0}}Q(\cdot-X_{0})$ as $t\to\infty$ in
$H^{1}(\mathbb{R}^{d})$. This argument is similar to the case of positive $K$,
done by Duyckaerts and Roudenko [8] (see also [3]). Once we get the
convergence, we can show that the uniformly bounded global solution $u$ is of
finite variance by using negativity of $K$. The solution with finite variance
must be $Q^{+}$ up to symmetries by [8, 3]. This implies Theorem 1.1.

##  2\. Preliminaries

###  2.1. Variational structure

In this section, we collect lemmas concerning the variational structure.

######  Lemma 2.1 (Pohozaev identity (e.g. [4, Corollary 8.1.3])).

We have

$\displaystyle\|Q\|_{L^{p+1}}^{p+1}=\frac{2(p+1)}{d(p-1)}\|\nabla
Q\|_{L^{2}}^{2}=\frac{p+1}{p-1}\|Q\|_{L^{2}}^{2}.$

In particular, we have

$\displaystyle E(Q)=\frac{d(p-1)-4}{2d(p-1)}\|\nabla Q\|_{L^{2}}^{2}.$

The next lemma follows from the variational structure of $Q$.

######  Lemma 2.2.

Let $u_{0}$ satisfy $M(u_{0})=M(Q)$ and $E(u_{0})=E(Q)$ and $u$ be the
solution to (NLS) with $u(0)=u_{0}$. Then we have the following.

  1. (1)

If $K(u_{0})>0$, then $K(u(t))>0$ for all $t\in\mathbb{R}$.

  2. (2)

If $K(u_{0})=0$, then $u_{0}(x)=e^{i\theta_{0}}Q(x-x_{0})$ for some
$\theta_{0}\in\mathbb{R}$ and $x_{0}\in\mathbb{R}^{d}$.

  3. (3)

If $K(u_{0})<0$, then $K(u(t))<0$ for all $t$ in the interval of existence.

See [8, Lemma 2.2] for the proof when $d=3$ and $p=3$.

###  2.2. Localized virial identity

For a solution $u$ to (NLS), define

$\displaystyle J_{R}(t)=\int_{\mathbb{R}^{d}}\varphi_{R}(x)|u(t,x)|^{2}dx,$

where $\varphi_{R}(x)=R^{2}\varphi\left(\frac{|x|}{R}\right)$ and
$\varphi:[0,\infty)\to[0,\infty)$ satisfies

$\displaystyle\varphi(r)=\begin{cases}r^{2},&(r\leq 1),\\\ 0,&(r\geq
3).\end{cases}$

and

$\displaystyle\frac{d^{2}\varphi}{dr^{2}}(r)\leq 2\text{ for }r\geq 0.$

Then by standard computations we have

$\displaystyle J_{R}^{\prime}(t)$
$\displaystyle=2\operatorname{Im}\int_{\mathbb{R}^{d}}\nabla\varphi_{R}\nabla
u\overline{u}dx,$ $\displaystyle J_{R}^{\prime\prime}(t)$
$\displaystyle=8K(u(t))+A_{R}(u(t)),$

where

$\displaystyle A_{R}(u(t))$ $\displaystyle=\int_{|x|\geq R}|\nabla
u(t,x)|^{2}\left(4\partial_{r}^{2}\varphi_{R}-8\right)dx$
$\displaystyle\quad+\frac{2(p-1)}{p+1}\int_{|x|\geq
R}|u(t,x)|^{p+1}\left(2d-\Delta\varphi_{R}\right)dx+\int_{|x|\geq
R}|u(t,x)|^{2}\Delta^{2}\varphi_{R}dx.$

###  2.3. Strichartz norms

Let $s\in[0,1)$. We say that a pair $(q,r)\in\mathbb{R}^{2}$ is
$\dot{H}^{s}$-admissible and denote $(q,r)\in\Lambda_{s}$ if

$\displaystyle\frac{2}{q}+\frac{d}{r}=\frac{d}{2}-s,\quad\frac{2d}{d-2s}<r<\frac{2d}{d-2}.$

We define

$\displaystyle\|u\|_{S(\dot{H}^{s};I)}:=\sup_{(q,r)\in\Lambda_{s}}\|u\|_{L_{t}^{q}(I;L_{x}^{r})}.$

We set $\|u\|_{S(\dot{H}^{s})}=\|u\|_{S(\dot{H}^{s};\mathbb{R})}$ for short.

##  3\. Modulation

We define

$\displaystyle\mu(f):=\|\nabla Q\|_{L^{2}}^{2}-\|\nabla f\|_{L^{2}}^{2}.$

By the Pohozaev identity, if $E(u)=E(Q)$, we have

$\displaystyle K(u)=\frac{d(p-1)-4}{4}\mu(u).$

See [8, 3] for Lemmas 3.1 and 3.2 below.

######  Lemma 3.1 (Modulation).

There exist a positive constant $\mu_{0}$ and a function
$\varepsilon(\mu):(0,\mu_{0})\to(0,\infty)$ with $\varepsilon(\mu)\to 0$ as
$\mu\to 0$ such that, for any $f\in H^{1}(\mathbb{R}^{d})$ satisfying
$M(f)=M(Q)$, $E(f)=E(Q)$, and $|\mu(f)|<\mu_{0}$, there exist a
$C^{1}$-mapping $f\mapsto(x,\theta)$ satisfying

$\displaystyle\|e^{-i\theta}f(\cdot+x)-Q\|_{H^{1}}\leq\varepsilon(\mu(f)),$
$\displaystyle\operatorname{Im}\int_{\mathbb{R}^{d}}g(x)Q(x)dx=0\text{ and
}\operatorname{Re}\int_{\mathbb{R}^{d}}g(x)\nabla Q(x)dx=0,$

where $g=e^{-i\theta}f(\cdot+x)-Q$.

Let $u$ be a solution to (NLS) and
$I_{\mu_{0}}:=\\{t\in\mathbb{R}:|\mu(u(t))|<\mu_{0}\\}$. Then by choosing
$(x(t),\theta(t))$ for $t\in I_{\mu_{0}}$ as in Lemma 3.1, we can write

$\displaystyle
u(t,x+x(t))=e^{i\theta(t)+it}(Q+g)=e^{i\theta(t)+it}(Q+\rho(t)Q+h),$

where

$\displaystyle\rho(t):=\frac{\operatorname{Re}\int
gQ^{p}dx}{\|Q\|_{L^{p+1}}^{p+1}}.$

######  Lemma 3.2 (Estimates for the modulation parameters).

Let $u$ be a solution to (NLS) satisfying $M(u)=M(Q)$ and $E(u)=E(Q)$. The
following estimates are valid for $t\in I_{\mu_{0}}$, taking $\mu_{0}$ smaller
if necessary:

$\displaystyle|\rho(t)|\approx\|h(t)\|_{H^{1}}\approx\|g(t)\|_{H^{1}}\approx\left|\operatorname{Re}\int
Qhdx\right|\approx|\mu(u(t))|,$
$\displaystyle|\rho^{\prime}(t)|+|x^{\prime}(t)|+|\theta^{\prime}(t)|\lesssim|\mu(u(t))|.$

##  4\. Profile decomposition

We have the following nonlinear profile decomposition. See [13, Proposition
3.6] and [14, Proposition 6.5]

######  Lemma 4.1 (Nonlinear profile decomposition).

Let $\\{\varphi_{n}\\}_{n\in\mathbb{N}}$ be a bounded sequence in
$H^{1}(\mathbb{R}^{d})$. Then, there exists a subsequence, which is also
denoted by $\\{\varphi_{n}\\}_{n\in\mathbb{N}}$, sequences
$\\{\psi^{j}\\}_{j\in\mathbb{N}}$ and $\\{W_{n}^{j}\\}_{n,j\in\mathbb{N}}$ in
$H^{1}(\mathbb{R}^{d})$, time sequence $\\{t_{n}^{j}\\}_{n,j\in\mathbb{N}}$ in
$\mathbb{R}$, and spatial sequence $\\{x_{n}^{j}\\}_{n,j\in\mathbb{N}}$ in
$\mathbb{R}^{n}$ such that

$\displaystyle\varphi_{n}=\sum_{j=1}^{J}\operatorname{NLS}(-t_{n}^{j})\psi^{j}(\cdot-
x_{n}^{j})+W_{n}^{J}$

for each $J\in\mathbb{N}$, and the following statements hold:

  1. (1)

For fixed $j$, $t_{n}^{j}=0$ for all $n$ or $|t_{n}^{j}|\to\infty$ as
$n\to\infty$.

  2. (2)

If $t_{n}^{j}\to\infty$, then
$\|\operatorname{NLS}(-t)\psi^{j}\|_{S(\dot{H}^{s_{c}};[0,\infty))}<\infty$
and if $t_{n}^{j}\to-\infty$, then
$\|\operatorname{NLS}(-t)\psi^{j}\|_{S(\dot{H}^{s_{c}};(-\infty,0])}<\infty$.

  3. (3)

The orthogonality of the parameters: for $j\neq k$,

$\displaystyle\lim_{n\to\infty}|t_{n}^{j}-t_{n}^{k}|+|x_{n}^{j}-x_{n}^{k}|=\infty.$

  4. (4)

Smallness of the remainder: $\operatorname{NLS}(t)W_{n}^{J}$ is global for
sufficiently large $J$ and

$\displaystyle\lim_{n\to\infty}\|\operatorname{NLS}(t)W_{n}^{J}\|_{S(\dot{H}^{s_{c}})}\to
0\text{ as }J\to\infty.$

  5. (5)

The orthogonality of the norms: For any $J\in\mathbb{N}$,

$\displaystyle\|\varphi_{n}\|_{\dot{H}^{s}}^{2}=\sum_{j=1}^{J}\|\operatorname{NLS}(-t_{n}^{j})\psi^{j}\|_{\dot{H}^{s}}^{2}+\|W_{n}^{J}\|_{\dot{H}^{s}}^{2}+o_{n}(1)$

for all $s\in[0,1]$ and

$\displaystyle\|\varphi_{n}\|_{L^{p+1}}^{p+1}=\sum_{j=1}^{J}\|\operatorname{NLS}(-t_{n}^{j})\psi^{j}\|_{L^{p+1}}^{p+1}+\|W_{n}^{J}\|_{L^{p+1}}^{p+1}+o_{n}(1).$

In particular, we have

$\displaystyle E(\varphi_{n})=\sum_{j=1}^{J}E(\psi^{j})+E(W_{n}^{J})+o_{n}(1)$

for any $J\in\mathbb{N}$.

We also have the following $\dot{H}^{1}$-orthogonality along the flow. See
[13, Lemma 3.9] and [14, Lemma 6.7]

######  Lemma 4.2 ($\dot{H}^{1}$ Pythagorean decomposition along the NLS
flow).

Let $\\{\varphi_{n}\\}_{n\in\mathbb{N}}$ be a bounded sequence in
$H^{1}(\mathbb{R}^{d})$. Fix time $T\in(0,\infty)$ arbitrarily. Assume that
$u_{n}(t):=\operatorname{NLS}(t)\varphi_{n}$ exists on $[0,T]$ for all
$n\in\mathbb{N}$ and

$\displaystyle\sup_{n\in\mathbb{N}}\|\nabla
u_{n}(t)\|_{L^{\infty}L^{2}[0,T]}<\infty.$

Let $W_{n}^{J}(t):=\operatorname{NLS}(t)W_{n}^{J}$, where $W_{n}^{J}$ is as in
Lemma 4.1 and $W_{n}^{J}(t)$ is global if $J,n$ are large. If $J$ is
sufficiently large, then, for all $j$,
$v^{j}(t-t_{n}^{j}):=\operatorname{NLS}(t-t_{n}^{j})\psi^{j}$ exists on
$[0,T]$ for large $n$ and

$\displaystyle\|\nabla u_{n}(t)\|_{L^{2}}^{2}=\sum_{j=1}^{J}\|\nabla
v^{j}(t-t_{n}^{j})\|_{L^{2}}^{2}+\|\nabla W_{n}^{J}(t)\|_{L^{2}}^{2}+o_{n}(1)$
(4.1)

for all $t\in[0,T]$, where $o_{n}(1)\to 0$ uniformly on $[0,T]$. We also have

$\displaystyle\|\varphi_{n}\|_{L^{p+1}}^{p+1}=\sum_{j=1}^{J}\|v^{j}(t-t_{n}^{j})\|_{L^{p+1}}^{p+1}+\|W_{n}^{J}(t)\|_{L^{p+1}}^{p+1}+o_{n}(1)$
(4.2)

for $t\in[0,T]$.

The following lemma is essentially given by [13, Lemma 4.7] and [14, Lemma
6.7].

######  Lemma 4.3 (Profile reordering).

Let $\\{\varphi_{n}\\}_{n\in\mathbb{N}}$ be a bounded sequence in
$H^{1}(\mathbb{R}^{d})$. Assume that $M(\varphi_{n})=M(Q)$,
$E(\varphi_{n})=E(Q)$, and $\|\nabla\varphi_{n}\|_{L^{2}}/\|\nabla
Q\|_{L^{2}}>1$ for all $n$. Then the profiles can be reordered such that there
exist $1\leq J_{1}\leq J_{2}\leq J$ and

  1. (1)

For each $1\leq j\leq J_{1}$, we have $t_{n}^{j}=0$ and
$v^{j}(t):=\operatorname{NLS}(t)\psi^{j}$ does not scatter as $t\to\infty$.

  2. (2)

For each $J_{1}+1\leq j\leq J_{2}$, we have $t_{n}^{j}=0$ and $v^{j}(t)$
scatters as $t\to\infty$.

  3. (3)

For each $J_{2}+1\leq j\leq J$, we have $|t_{n}^{j}|\to\infty$. (In
particular, $v^{j}(t)$ scatters in at least one directions by (2) in Lemma
4.1. )

Moreover, $J_{1}\geq 1$. ($J_{2}=J_{1}$ or $J_{2}=J$ may occur. In that case,
there is no $j$ satisfying the second and third statement, respectively.)

###### Proof.

Reordering as $t_{n}^{j}=0$ for $1\leq j\leq J_{2}$ and $|t_{n}^{j}|\to\infty$
for $J_{2}+1\leq j\leq J$ is done by suitable numbering. We show $J_{1}\geq
1$.

Step 1. We show that there exists at least one $j$ such that $t_{n}^{j}=0$.
Suppose that $|t_{n}^{j}|\to\infty$ for all $j$. By the Pohozaev identity,
$E(\varphi_{n})=E(Q)$, and $\|\nabla\varphi_{n}\|_{L^{2}}/\|\nabla
Q\|_{L^{2}}>1$, we have

$\displaystyle\frac{\|\varphi_{n}\|_{L^{p+1}}^{p+1}}{\|Q\|_{L^{p+1}}^{p+1}}=-\frac{1}{2}\frac{E(\varphi_{n})}{E(Q)}+\frac{3}{2}\frac{\|\nabla\varphi_{n}\|_{L^{2}}^{2}}{\|\nabla
Q\|_{L^{2}}^{2}}\geq-\frac{1}{2}+\frac{3}{2}>1.$

Since $|t_{n}^{j}|\to\infty$, we have
$\|\operatorname{NLS}(-t_{n}^{j})\psi^{j}\|_{L^{p+1}}\to 0$ as $n\to\infty$ by
(2) in Lemma 4.1. Then we have

$\displaystyle
1\leq\frac{\|\varphi_{n}\|_{L^{p+1}}^{p+1}}{\|Q\|_{L^{p+1}}^{p+1}}=\sum_{j=1}^{J}\frac{\|\operatorname{NLS}(-t_{n}^{j})\psi^{j}\|_{L^{p+1}}^{p+1}}{\|Q\|_{L^{p+1}}^{p+1}}+\frac{\|W_{n}^{J}\|_{L^{p+1}}^{p+1}}{\|Q\|_{L^{p+1}}^{p+1}}+o_{n}(1)$

and the right hand side is smaller than 1 for large $n,J$. This is a
contradiction.

Step 2. It remains to prove that there exists at least one $1\leq j\leq J_{2}$
such that $v^{j}(t):=\operatorname{NLS}(t)\psi(t)$ does not scatter in the
positive time direction. Suppose the statement fails. Then we have
$\lim_{t\to\infty}\|v^{j}(t)\|_{L^{p+1}}=0$ for all $1\leq j\leq J_{2}$ since
they scatter. Take $t_{0}$ sufficiently large such that
$\|v^{j}(t_{0})\|_{L^{p+1}}^{p+1}\leq\varepsilon/J_{2}$ for all $1\leq j\leq
J_{2}$. Let $u_{n}(t):=\operatorname{NLS}(t)\varphi_{n}$. Then the variational
structure implies $\|u_{n}(t)\|_{L^{p+1}}/\|Q\|_{L^{p+1}}>1$ for all $n$ and
$t$. By the orthogonality (4.2), we get

$\displaystyle\|Q\|_{L^{p+1}}^{p+1}$
$\displaystyle\leq\|u_{n}(t_{0})\|_{L^{p+1}}^{p+1}$
$\displaystyle=\sum_{j=1}^{J_{2}}\|v^{j}(t_{0})\|_{L^{p+1}}^{p+1}+\sum_{j=J_{2}+1}^{J}\|v^{j}(t_{0}-t_{n}^{j})\|_{L^{p+1}}^{p+1}+\|W_{n}^{J}(t_{0})\|_{L^{p+1}}^{p+1}+o_{n}(1)$
$\displaystyle\leq\varepsilon+\sum_{j=J_{2}+1}^{J}\|v^{j}(t_{0}-t_{n}^{j})\|_{L^{p+1}}^{p+1}+\|W_{n}^{J}(t_{0})\|_{L^{p+1}}^{p+1}+o_{n}(1).$

Taking large $J$ and the limit $n\to\infty$, the right hand side goes to
$\varepsilon$. Since $\varepsilon$ is sufficiently small, this is a
contradiction. ∎

##  5\. Proof of Main Theorem

###  5.1. Compactness of the uniformly bounded solution

In what follows, let $u_{0}$ satisfy (MEN) and $u$ be a solution to (NLS) on
at least $[0,\infty)$ satisfying $\mathbf{A}:=\sup_{t>0}\|\nabla
u(t)\|_{L^{2}}^{2}<\infty$. In this section, we show that the solution $u$ has
a compactness property.

######  Proposition 5.1.

Then for any time sequence $\\{t_{n}\\}$, there exists a subsequence, which is
still denoted by $\\{t_{n}\\}$, a spacial sequence $\\{x_{n}\\}$, and a
function $\psi\in H^{1}(\mathbb{R}^{d})$ such that $u(t_{n},\cdot+x_{n})$
converges to $\psi$ in $H^{1}(\mathbb{R})$.

###### Proof.

Apply Lemma 4.1 with $\varphi_{n}=u(t_{n})$, and reordering Lemma 4.3. Since
for $j\in[J_{1}+1,J]$, $v^{j}$ scatters in at least one direction,
$E(\psi^{j})=E(v^{j})\geq 0$. Thus by the energy decoupling we get

$\displaystyle\sum_{j=1}^{J_{1}}E(\psi^{j})\leq
E(u(t_{n}))+o_{n}(1)=E(Q)+o_{n}(1)\to E(Q).$

Thus there exists $j\in[1,J_{1}]$ such that $E(\psi^{j})\leq E(Q)$. We may
assume that $j=1$. We also have

$\displaystyle M(\psi^{1})\leq\sum_{j=1}^{J_{1}}M(\psi^{j})\leq
M(u(t_{n}))+o_{n}(1)=M(Q)+o_{n}(1)\to M(Q)$

and thus $M(\psi^{1})\leq M(Q)$. By Lemma 4.3, $v^{1}$ is a forward non-
scattering solution.

Case 1. $M(\psi^{1})<M(Q)$ or $E(\psi^{1})<E(Q)$.

In this case, we have
$M(\psi^{1})^{1-s_{c}}E(\psi^{1})^{s_{c}}<M(Q)^{1-s_{c}}E(Q)^{s_{c}}$. It
follows from [10, 1, 13] that $K(\psi^{1})<0$, and that $v^{1}$ blows up or
grows up in both directions by [1, 13, 9, 14]. There exists $T_{0}>0$ such
that $\|\nabla v^{1}(T_{0})\|_{L^{2}}^{2}\geq 2\mathbf{A}$. By (4.1), we get

$\displaystyle\mathbf{A}\geq\|\nabla u(T_{0}+t_{n})\|_{L^{2}}^{2}$
$\displaystyle=\sum_{j=1}^{J}\|\nabla
v^{j}(T_{0}-t_{n}^{j})\|_{L^{2}}^{2}+\|\nabla
W_{n}^{J}(T_{0})\|_{L^{2}}^{2}+o_{n}(1)$ $\displaystyle\geq\|\nabla
v^{1}(T_{0})\|_{L^{2}}^{2}+o_{n}(1)$ $\displaystyle\geq 2\mathbf{A}+o_{n}(1),$

where we note that $t_{n}^{1}=0$. This is a contradiction.

Case 2. $M(\psi^{1})=M(Q)$ and $E(\psi^{1})=E(Q)$.

Since we have $M(\psi^{1})=M(Q)$, by the orthogonality of $L^{2}$-norm, we get
$\psi^{j}=0$ for all $j\geq 2$. That is, we have
$u(t_{n})=\tau_{x_{n}^{1}}\psi^{1}+W_{n}^{1}$. The orthogonality of
$L^{2}$-norm also shows that $\|W_{n}^{1}\|_{L^{2}}\to 0$. Moreover, we have

$\displaystyle E(Q)=E(u)$ $\displaystyle=E(\psi^{1})+E(W_{n}^{1})+o_{n}(1)$
$\displaystyle=E(Q)+E(W_{n}^{1})+o_{n}(1).$

By this and (4) in Lemma 4.1, it holds that $\|\nabla W_{n}^{1}\|_{L^{2}}\to
0$ as $n\to\infty$. We get

$\displaystyle\|u(t_{n},\cdot+x_{n}^{1})-\psi^{1}\|_{H^{1}}=\|W_{n}^{1}\|_{H^{1}}\to
0$

as $n\to\infty$. ∎

Proposition 5.1 implies that there exists
$\widetilde{x}:(0,\infty)\to\mathbb{R}^{d}$ such that

$\displaystyle\\{u(t,\cdot+\widetilde{x}(t)):t>0\\}$

is precompact in $H^{1}(\mathbb{R}^{d})$. This is equivalent to the following:
for any $\varepsilon>0$, there exists $R=R(\varepsilon)>0$ such that

$\displaystyle\int_{|x-\widetilde{x}(t)|>R}|\nabla
u(t,x)|^{2}+|u(t,x)|^{2}dx\leq\varepsilon$

for all $t>0$.

We define $X$ by

$\displaystyle X(t)=\begin{cases}\widetilde{x}(t),&(t\not\in I_{\mu_{0}}),\\\
x(t),&(t\in I_{\mu_{0}}),\end{cases}$

where $x$ is the parameter appearing in the modulation argument, Section 3.
Then, we also find that for any $\varepsilon>0$ there exists
$R=R(\varepsilon)>0$ such that

$\displaystyle\int_{|x-X(t)|>R}|\nabla
u(t,x)|^{2}+|u(t,x)|^{2}dx\leq\varepsilon$

for all $t>0$. See the statement below the sketch of the proof of Lemma 6.2 in
[8].

###  5.2. Finite variance through convergence

In this section, we show that $u$ is of finite variance. To show this, we
first prove that $u$ converges to the ground state. The argument is same as in
Section 6.3 in [8]. See also [3].

######  Lemma 5.2.

For small $\varepsilon>0$, there exists a constant $R_{\varepsilon}$ such that

$\displaystyle|A_{R}(u(t))|\lesssim\varepsilon|\mu(t)|$

for $t>0$ and $R>R_{\varepsilon}+|X(t)|$.

###### Proof.

The proof is similar to Step 1 in the proof of Lemma 6.7 in [8]. ∎

######  Lemma 5.3.

Let $0<t_{1}<t_{2}<\infty$. Then it holds that

$\displaystyle\int_{t_{1}}^{t_{2}}|\mu(u(t))|dt\lesssim(1+\sup_{t_{1}<t<t_{2}}|X(t)|)\\{|\mu(u(t_{1}))|+|\mu(u(t_{2}))|\\}.$

###### Proof.

By Lemma 5.2, there exists a constant $R_{\varepsilon}$ such that if $R\geq
R_{\varepsilon}+|X(t)|$, then

$\displaystyle|A_{R}(u(t))|\lesssim\varepsilon|\mu(u(t))|.$

For $\varepsilon>0$ sufficiently small, it follows from this estimate and the
localized virial identity that

$\displaystyle J_{R}^{\prime\prime}(t)=4K(u(t))+A_{R}(u(t))\leq
c\mu(u(t))-\varepsilon\mu(u(t))\lesssim\mu(u(t))<0$

if $R\geq R_{\varepsilon}+|X(t)|$. Let
$R=R(t_{1},t_{2}):=R_{\varepsilon}+\sup_{t_{1}\leq t\leq t_{2}}|X(t)|$ for
arbitrarily $t_{1},t_{2}$. Then we have

$\displaystyle
0>\int_{t_{1}}^{t_{2}}\mu(u(t))dt\gtrsim\int_{t_{1}}^{t_{2}}J_{R}^{\prime\prime}(t)dt=J^{\prime}_{R}(t_{2})-J^{\prime}_{R}(t_{1}).$

In a similar way to Step 2 of the proof of Lemma 6.7 in [8], we have

$\displaystyle|J^{\prime}_{R}(t)|\lesssim R|\mu(u(t))|.$

Thus we get

$\displaystyle\int_{t_{1}}^{t_{2}}\mu(u(t))dt\gtrsim-R\\{|\mu(u(t_{1}))|+|\mu(u(t_{2}))|\\}.$

Since $\mu(u(t))<0$, we obtain the desired estimates. ∎

######  Lemma 5.4.

There exists a constant $C>0$ such that

$\displaystyle|X(t_{2})-X(t_{1})|\leq C\int_{t_{1}}^{t_{2}}|\mu(u(t))|dt$

for any $t_{2},t_{1}$ with $t_{2}\geq t_{1}+1$.

###### Proof.

See Lemma 6.8 in [8]. ∎

######  Lemma 5.5.

There exists a time sequence $\\{t_{n}\\}$ with $t_{n}\to\infty$ such that
$\mu(u(t_{n}))\approx K(u(t_{n}))\to 0$ as $n\to\infty$.

###### Proof.

By [1, 9], if there exists $\delta>0$ such that $\sup_{t>0}K(u(t))<-\delta$,
then $u$ must grow up in the positive time direction, a contradiction. ∎

######  Lemma 5.6.

There exists $\theta_{0}\in\mathbb{R}$, $x_{0}\in\mathbb{R}^{d}$, and $c>0$
such that

$\displaystyle\|u-e^{it+i\theta_{0}}Q(\cdot-x_{0})\|_{H^{1}}\leq e^{-ct}$

for all $t>0$.

###### Proof.

By Lemmas 5.3–5.5 and the modulation argument in Section 3, we obtain the
statement in the same way as in the proof of Proposition 6.1 in [8]. ∎

At last, we prove that $u$ has finite variance. This argument is similar to
the argument in Section 5.2 in [8], where they show that radial solutions
satisfying (MEN) are of finite variance. We use the convergence to the ground
state instead of radial symmetry. Finite variance of $u$ implies that
$u=Q^{+}$ and it also gives us Theorem 1.1.

######  Lemma 5.7.

The solution $u$ satisfies $\int|x|^{2}|u_{0}(x)|^{2}dx<\infty$.

###### Proof.

Let $\varepsilon>0$ be small. For any $R>0$,

$\displaystyle\int_{|x|>R}|\partial_{x}u(t,x)|^{2}+|u(t,x)|^{2}dx$
$\displaystyle\lesssim\|u(t)-e^{it+i\theta_{0}}Q(\cdot-x_{0})\|_{H^{1}}^{2}$
$\displaystyle\quad+\int_{|x|>R}|\partial_{x}Q(x-x_{0})|^{2}+|Q(x-x_{0})|^{2}dx$

Thus taking $T_{\varepsilon}>0$ and $R_{\varepsilon}>0$ sufficiently large,
for $t>T_{\varepsilon}$ and $R>R_{\varepsilon}$ we have

$\displaystyle\|u(t)-e^{it+i\theta_{0}}Q(\cdot-
x_{0})\|_{H^{1}}^{2}\leq\frac{C^{-1}}{2}\varepsilon$

and

$\displaystyle\int_{|x|>R}|\partial_{x}Q(x-x_{0})|^{2}+|Q(x-x_{0})|^{2}dx\leq\frac{C^{-1}}{2}\varepsilon.$

Therefore, we get

$\displaystyle\int_{|x|>R}|\partial_{x}u(t,x)|^{2}+|u(t,x)|^{2}dx\leq\frac{1}{2}\varepsilon+\frac{1}{2}\varepsilon=\varepsilon$

for any $t>T_{\varepsilon}$ and $R>R_{\varepsilon}$. By Lemma 5.2 as
$X(t)\equiv 0$, we get

$\displaystyle|A_{R}(u(t))|\lesssim\varepsilon|\mu(u(t))|$

for $t>T_{\varepsilon}$ and $R>R_{\varepsilon}$ (choosing these larger if
necessary). It follows from this estimate and the localized virial identity
that

$\displaystyle J_{R}^{\prime\prime}(t)=4K(u(t))+A_{R}(u(t))\leq
c\mu(u(t))-\varepsilon\mu(u(t))\lesssim\mu(u(t))$

for $t>T_{\varepsilon}$, where we note that $\mu(u(t))<0$. As a consequence,
we find that $J_{R}^{\prime}(t)>0$ for $t>T_{\varepsilon}$. Indeed, if not,
there exists a time $t_{1}>T_{\varepsilon}$ such that
$J_{R}^{\prime}(t_{1})\leq 0$. Since $J_{R}^{\prime\prime}(t)<0$ for
$t>T_{\varepsilon}$, $J_{R}^{\prime}$ is decreasing and thus there exists
$t_{2}>t_{1}$ such that $J_{R}^{\prime}(t_{2})<0$ and $J_{R}^{\prime}(t)\leq
J_{R}^{\prime}(t_{2})<0$ for $t\geq t_{2}$, so $J_{R}(t)$ becomes negative for
large $t$, a contradiction. Hence we have $J_{R}^{\prime}(t)>0$ for
$t>T_{\varepsilon}$. It holds that

$\displaystyle\int_{\mathbb{R}^{d}}\varphi_{R}(x)|u(T_{\varepsilon},x)|^{2}dx=J_{R}(T_{\varepsilon})\leq
J_{R}(t)=\int_{\mathbb{R}^{d}}\varphi_{R}(x)|u(t,x)|^{2}dx$

for all $t>T_{\varepsilon}$. Now we have

$\displaystyle\int_{\mathbb{R}^{d}}\varphi_{R}(x)|u(t,x)|^{2}dx$
$\displaystyle\lesssim R^{2}\|u(t)-e^{it+i\theta_{0}}Q(\cdot-
x_{0})\|_{L^{2}}^{2}+\int_{\mathbb{R}^{d}}|x|^{2}|Q(x-x_{0})|^{2}dx$

and thus

$\displaystyle\limsup_{t\to\infty}\int_{\mathbb{R}^{d}}\varphi_{R}(x)|u(t,x)|^{2}dx\lesssim\int_{\mathbb{R}^{d}}|x|^{2}|Q(x-x_{0})|^{2}dx<C.$

Thus, we get

$\displaystyle\int_{\mathbb{R}^{d}}\varphi_{R}(x)|u(T_{\varepsilon},x)|^{2}dx\leq\limsup_{t\to\infty}\int_{\mathbb{R}^{d}}\varphi_{R}(x)|u(t,x)|^{2}dx\leq
C.$

Since $\lim_{R\to\infty}\varphi_{R}(x)=|x|^{2}$ for all $x\in\mathbb{R}^{d}$,
it follows from the Fatou lemma that

$\displaystyle\int_{\mathbb{R}^{d}}|x|^{2}|u(T_{\varepsilon},x)|^{2}dx\leq\liminf_{R\to\infty}\int_{\mathbb{R}^{d}}\varphi_{R}(x)|u(T_{\varepsilon},x)|^{2}dx\leq
C.$

This completes the proof. ∎

######  Proposition 5.8.

We have $u=Q^{+}$ up to symmetries (except for time reversal).

###### Proof.

By Lemma 5.7, $u$ satisfies (MEN) and $|x||u_{0}|\in L^{2}$. Thus, by [3,
Theorem 1.3], $u$ blows up in both time directions or $u=Q^{+}$ up to
symmetries. Since $u$ is global in the positive time direction, we get
$u=Q^{+}$. ∎

## Acknowledgement

Research of the first author is partially supported by an NSERC Discovery
Grant. The second author is supported by JSPS Overseas Research Fellowship and
KAKENHI Grant-in-Aid for Early-Career Scientists No. JP18K13444.

## References

  * [1] T. Akahori, H. Nawa, Blowup and scattering problems for the nonlinear Schrödinger equations, Kyoto J. Math. 53 (2013), no. 3, 629–672.
  * [2] A. K. Arora, B. Dodson, J. Murphy, Scattering below the ground state for the 2$d$ radial nonlinear Schrödinger equation, Proc. Amer. Math. Soc. 148 (2020), no. 4, 1653–1663.
  * [3] L. Campos, L. G. Farah, S. Roudenko _Threshold solutions for the nonlinear Schrödinger equation_ , preprint, arXiv:2010.14434.
  * [4] T. Cazenave, Semilinear Schrödinger Equations, Courant Lecture Notes in Mathematics, vol. 10, American Mathematical Society, Courant Institute of Mathematical Sciences, 2003.
  * [5] B. Dodson, J. Murphy, A new proof of scattering below the ground state for the 3D radial focusing cubic NLS, Proc. Amer. Math. Soc. 145 (2017), no. 11, 4859–4867.
  * [6] B. Dodson, J. Murphy, A new proof of scattering below the ground state for the non-radial focusing NLS Math. Res. Lett. 25 (2018), no. 6, 1805–1825.
  * [7] T. Duyckaerts, J. Holmer, S. Roudenko, Scattering for the non-radial 3D cubic nonlinear Schrödinger equation, Math. Res. Lett. 15 (2008), no. 6, 1233–1250.
  * [8] T. Duyckaerts, S. Roudenko, _Threshold solutions for the focusing 3D cubic Schrödinger equation_ , Rev. Mat. Iberoamericana 26 No.1, (2010), 1–56.
  * [9] D. Du, Y. Wu, K. Zhang, On Blow-up criterion for the Nonlinear Schrödinger Equation, Discrete Contin. Dyn. Syst., 36 (2016), 3639–3650.
  * [10] D. Y. Fang, J. Xie, T. Cazenave, Scattering for the focusing energy-subcritical nonlinear Schrödinger equation, Sci. China Math. 54 (2011), no. 10, 2037–2062.
  * [11] J. Ginibre, G. Velo, On a class of nonlinear Schrödinger equations. I. The Cauchy problem, general case, J. Funct. Anal., 32 (1979), 1–32.
  * [12] R. T. Glassey, On the blowing up of solutions to the Cauchy problem for nonlinear Schrödinger equations, J. Math. Phys. 18 (1977), no. 9, 1794–1797.
  * [13] C. D. Guevara, Global behavior of finite energy solutions to the d-dimensional focusing nonlinear Schrödinger equation, Appl. Math. Res. Express. AMRX 2014, no. 2, 177–243.
  * [14] Q. Guo, Divergent solutions to the $L^{2}$-supercritical NLS equations, Acta Math. Appl. Sin. Engl. Ser. 32 (2016), no. 1, 137–162.
  * [15] Z. Guo, J. Shen, Scattering below the ground state for the 2D non-linear Schrödinger and Klein-Gordon equations revisited, J. Math. Phys. 61 (2020), no. 8, 081507, 20 pp.
  * [16] J. Holmer, S. Roudenko, A sharp condition for scattering of the radial 3D cubic nonlinear Schrödinger equation, Comm. Math. Phys. 282 (2008), no. 2, 435–467.
  * [17] J. Holmer, S. Roudenko, Divergence of infinite-variance nonradial solutions to the 3D NLS equation, Comm. Partial Differential Equations 35 (2010), no. 5, 878–905.
  * [18] C. E. Kenig, F. Merle, Global well-posedness, scattering and blow-up for the energy-critical, focusing, non-linear Schrödinger equation in the radial case, Invent. Math. 166 (2006), no. 3, 645–675.
  * [19] S. Keraani, On the defect of compactness for the Strichartz estimates of the Schrödinger equations, J. Differential Equations 175 (2001), no. 2, 353–392.
  * [20] F. Linares, G. Ponce, Introduction to nonlinear dispersive equations. Second edition, Universitext. Springer, New York, 2015. xiv+301 pp.
  * [21] Y. Martel, P. Raphaël, Strongly interacting blow up bubbles for the mass critical nonlinear Schrödinger equation, Ann. Sci. Éc. Norm. Supér. (4) 51 (2018), no. 3, 701–737.
  * [22] K. Nakanishi, W. Schlag, Global dynamics above the ground state energy for the cubic NLS equation in 3D, Calc. Var. Partial Differential Equations 44 (2012), no. 1-2, 1–45.
  * [23] T. Ogawa, Y. Tsutsumi, Blow-Up of $H^{1}$ solution for the Nonlinear Schrödinger Equation, J. Diff. Eq. 92, 317–330 (1991).
  * [24] T. Ogawa, Y. Tsutsumi, Blow-up of $H^{1}$ solutions for the one-dimensional nonlinear Schrödinger equation with critical power nonlinearity, Proc. Amer. Math. Soc. 111 (1991), no. 2, 487–496.
  * [25] T. Tao, On the asymptotic behavior of large radial data for a focusing non-linear Schrödinger equation, Dyn. Partial Differ. Equ. 1 (2004), no. 1, 1–48.
  * [26] T. Tao, Nonlinear dispersive equations. Local and global analysis, CBMS Regional Conference Series in Mathematics, 106. Published for the Conference Board of the Mathematical Sciences, Washington, DC; by the American Mathematical Society, Providence, RI, 2006. xvi+373 pp.


# Survey on Tools and Techniques Detecting Microservice API Patterns

Alexander Bakhtin  Tampere University
Tampere, Finland
<EMAIL_ADDRESS>Abdullah Al Maruf  Computer Science, Baylor
University
Waco, TX, USA
<EMAIL_ADDRESS>Tomas Cerny  Computer Science, Baylor University
Waco, TX, USA
<EMAIL_ADDRESS>Davide Taibi  Tampere University
Tampere, Finland
<EMAIL_ADDRESS>
###### Abstract

It is well recognized that design patterns improve system development and
maintenance in many aspects. While we commonly recognize these patterns in
monolithic systems, many patterns emerged for cloud computing, specifically
microservices. Unfortunately, while various patterns have been proposed,
available quality assessment tools often do not recognize many. This article
performs a grey literature review to find and catalog available tools to
detect microservice API patterns (MAP). It reasons about mechanisms that can
be used to detect these patterns. Furthermore, the results indicate gaps and
opportunities for improvements for quality assessment tools. Finally, the
reader is provided with a route map to detection techniques that can be used
to mine MAPs.

###### Index Terms:

Microservice API Patterns, Design Patterns, Best Practices, Pattern Matching,
Static Analysis, Dynamic Analysis, Pattern Mining Tools

##  I Introduction

Design patterns provide a generalized and reusable solution to common software
design problems. They indicate that a system uses best practices. Patterns are
well-recognized to improve software quality [1]. One of the reasons behind
such impact is better software comprehension related to software
documentation. Detection of patterns is a complex task [2, 3]. It can
constitute static or dynamic system analysis and serves the purpose of quality
assurance and quality indices of system design.

With the era of cloud systems, we must assume new patterns emerge that
constitute possibly across multiple self-contained parts of the overall
system. In the current context, cloud computing is fueled by the microservice
architecture [4]. Microservices are small and autonomous services deployed
independently, with a single and clearly defined purpose [5, 6]. We ask what
techniques and state-of-the-art tools can detect microservice patterns and the
current gaps in this context.

Many challenges need to be taken into account when detecting patterns in
cloud-based systems. For instance, the cloud-native development best practices
[4] suggest separating microservice codebases to enable decentralized
evolution. However, current static analysis tools operate on a single codebase
[7] only. As a result, we cannot detect patterns that span across the whole
system by concatenating analysis per codebase. This often leads to an
alternative direction - dynamic analysis. Dynamic analysis tools can operate
on the decentralized perspective [8]. However, the dynamic analysis does not
reveal a comprehensive detail of the system (e.g., concerning the actual
implementation of the service). Quality engineers, architects, and developers
might need to know underlying code quality details to improve maintenance and
support system comprehension.

This paper considers a catalog of well-established Microservice-specific API
design Patterns (MAP). It reports tools that can detect these patterns and
mechanisms for the detection (i.e., static analysis, tracing, log mining). The
goal is to identify current gaps in pattern mining and quality assurance
automation tools.

To approach this, we adopted a Multivocal Literature Review (MLR) process [9]
surveying the systematic gray literature. The key motivation for conducting an
MLR and therefore including the grey literature is the strong interest of
practitioners on the subject, and grey literature content creates a foundation
for future research.

As a result, this work identifies a list of 46 MAPs and 59 pattern mining
tools. Out of the 46 patterns, 34 have been addressed by found tools. These 34
MAPs can be discovered by 26 tools out of 59. Most importantly, we identified
gaps in current tools to support MAP pattern identification. We further
provide discussion for the reasons behind such a gap and what needs to be
addressed to overcome the current hurdles.

The remainder of this paper is structured as follows. Section II presents the
background and related works. Section III provides detailed information on the
gray literature review process we adopted. Section IV reports the results to
our RQs. Section V discusses implications for practitioners and researchers.
Section VI highlights the threats to validity while finally, Section VII draws
the conclusions.

##  II Background and Related Work

One way to determine software quality is to analyze software for patterns and
to verify that it doesn’t contain anti-patterns [2, 3] or to calculate quality
metrics such as coupling and cohesion [10]. Different tools have been proposed
to perform automatic quality reviews using static analysis of code to operate
on pattern detection [11]. Pattern mining has been broadly researched [12, 2,
13] and it is a well-established domain, at least for monolithic applications.

Various microservices patterns have also been identified [4, 14, 15] for
various tasks, such as porting from monoliths [15], supporting resilience
[14], targeting good design practices [2, 16], among others. Development
frameworks apply these patterns [14] to simplify development.

In this paper, we consider current Microservice API Patterns (MAP further in
the text) reported on the API-Pattern website [17, 3]. The API-Pattern website
collects the vast majority of microservices patterns proposed by its creators
in peer-reviewed literature [3, 18, 19, 20, 21, 22, 23]. The list of patterns
is provided in Table I while the complete description of each pattern can be
found on the API-pattern website [17]. We have, however, excluded the pattern
“Annotated Parameter Collection” as it lacked a detailed description.

The major difference between monolith and cloud systems in regards to pattern
mining, however, is the decentralized codebase, which likely introduces
diversity, heterogeneity, and no obvious connection across codebases. Despite
initial codebase convention efforts, these get easily lost with evolution and
management diversity.

Because of possible diversity across microservices, practitioners often resort
to assessing cloud systems through dynamic analysis [24, 14]. However, with
such direction, we can recognize endpoints and calls but not internal
microservice details often needed for pattern detection (since many patterns,
including some MAP, have to do with internal implementation as well, e.g.
_“Backend Integration”_).

When we consider other current analysis approaches [24], we can notice that
static analysis of code or mining software repositories involves code parsing
and conversion to syntax trees or various graph representations as an
intermediate representation. Then it uses these intermediate representations
to identify patterns. Other approaches consider log analysis. However, these
approaches face difficulty with the non-structured format of log messages.
While log clustering can be used, it is very challenging. For this reason, it
is common to integrate event tracing, which adds logging statements to calls
(i.e., via instrumentation) and collects additional information in log
messages, including the originating microservice or the correlation ID to
determine distributed transactions and related log messages [25].

Another approach worth mentioning is program slicing [26], which combines log
analysis with code analysis. This is accomplished by locating logging
statements in the code and identifying logging templates in these statements;
these are then matched with log messages found in logs to these code locations
[27]. For instance, in Lprof [27], the authors used program slicing to profile
distributed systems and optimize their performance. They matched log
statements with log messages and performed a data-flow analysis of method
parameters to identify if these parameters change across call paths. Unchanged
parameters identified related log messages and could be used as a correlation
ID similar to event tracing. Using this, they could recognize distributed
transactions and their frequencies in logs. However, with event tracing (i.e.,
OpenTelemetry [28]), such tasks become much more simplified and commonly
adopted by industry (establishing the correlation ID). Any of these techniques
could be used to help with detecting MAPs.

##  III Study Design

This section describes the methods adopted to gather and classify the
different tools to detect microservices best practices.

Since our goal is to map existing tools recommended and adopted by
practitioners, we performed a systematic review of the grey literature. A
review of peer-review literature would be biased toward academic opinions and
would not clearly enable us to understand what practitioners can find when
looking for such types of tools online.

In order to investigate the aforementioned goal, we formulated our research
questions as:

RQ1: Which are the tools available to detect MAPs?

This RQ aims to find tools dedicated to mining-specific patterns described in
the previous section. Even though some of them could be identified using
general-purposes testing tools, the necessity to write tests for the specific
patterns makes it unfeasible for the patterns to be adopted in the industry,
while having a set of ready-made tools that could be incorporated into the
CD/CI pipeline would facilitate the adoption of best practices and improve
code and design quality.

RQ2: Which MAPs can be detected automatically with tools?

In this RQ, we map the tools identified in RQ1 to the patterns they detect.

RQ3: Which techniques can be used to detect MAPs?

In this RQ, we aim to understand whether MAPs can be detected using static or
dynamic analysis tools. The possibility of detecting the pattern from static
analysis tools would enable understanding of the patterns used without running
the system. In contrast, the detection based on the dynamic execution of the
system and the collection of log traces would allow an understanding of how
the system is actually behaving.

###  III-A The Review Process

Grey literature Reviews and Multivocal Literature Reviews (MLR) proved to be
the best choice for the research method due to the lack of maturity of the
subject. MLR includes both academic and grey literature. However, since we are
aimed at investigating the word of mouth of practitioners, we will perform a
review of the only grey literature. The key motivation for the inclusion of
grey literature is the strong interest of practitioners in the subject, and
grey literature content creates a foundation for future research.

The process adopted is similar to the MLR, but doesn’t include the peer-
reviewed literature steps.

The process we adopted was based on these steps:

  * $\bullet$

Selection of keywords and search approach

  * $\bullet$

Initial search and creation of an initial pool of sources

  * $\bullet$

Snowballing

  * $\bullet$

Reading through material

  * $\bullet$

Application of inclusion / exclusion criteria

  * $\bullet$

Evaluation of the quality of the grey literature sources

  * $\bullet$

Creation of the final pool of sources

###  III-B Literature Search Process

Since we are interested in finding tools to detect MAPs (Table I), we created
53 query search strings. The search strings were as follows:

  * •

"pattern_name" api pattern detection tool, where pattern_name was replaced
with every pattern from table I (46 total searches, excluding _“Annotated
Parameter Collection”_ pattern)

  * •

api security analysis tool

  * •

api parameter analysis tool

  * •

api parameter discovery tool

  * •

api documentation analysis tool

  * •

api specification analysis tool

  * •

semantic versioning identification tool

  * •

microservice api pattern detection tool

The latter strings were added because the first parametric search string did
not produce many meaningful results, and at the same time, many patterns can
be grouped together, as represented by other search strings. We understand
that not all groups of patterns are represented by latter search strings, so
partial bias is introduced; however, we could not think of search strings
targeting other groups of patterns and, as stated before, not using them
produced only a handful of results.

Table I: The list of Microservice API patterns [17] Foundation |  Quality
---|---
Frontend integration |  API Key
Backend integration |  Rate Limit
Public API |  Rate Plan
Community API |  Service Level Agreement
Solution Internal API |  Error Report
API Description |  Conditional Request
Responsibility |  Request Bundle
Processing Resource |  Wish List
Information Holder Resource |  Wish Template
Computation Function |  Embedded Entity
State Creation Operation |  Structure
Retrieval Operation |  Atomic Parameter
State Transition Operation |  Atomic Parameter List
Operational Data Holder |  Parameter Tree
Master Data Holder |  Parameter Forest
Reference Data Holder |  Data Element
Data Transfer Resource |  Id Element
Link Lookup Resource |  Link Element
Evolution |  Metadata Element
Version Identifier |  Annotated Parameter Collection
Semantic Versioning |  Context Representation
Two In Production |
Aggressive Obsolescence |
Experimental Preview |
Limited Lifetime Guarantee |
Eternal Lifetime Guarantee |

We applied the Search strings to the Google Search111www.google.com engine,
looking at 10 pages of results per search (excluding ads). The search was done
with Incognito browser mode without logging into a personal Google account.
The decision to use 10 pages of results was adopted after an informal piloting
of the search, which showed that no relevant results appear on pages 9-10 of
the search and that for some patterns (search strings) only a few results (2-3
pages, sometimes not enough even for 1 page) are returned.

Search results consisted of blog posts (including blogs with lists of tools),
websites, research papers, Github222www.github.com repositories of tools, and
Github repositories of lists of tools. It is good to note that
StackOverflow333www.stackoverflow.com is a popular website for technical peer
questions, and it could be expected to appear in the search results, but in
reality, it did not. It could have been included in the study separately, but
after piloting it, it did not provide meaningful results, so in this paper, we
decided to focus only on Google Search.

This search was performed between 10th and 21st of January 2022.

###  III-C Snowballing

We applied a backward snowballing to the retrieved literature in the following
way:

  * •

If the resource extracted from the search is a list of tools (as opposed to a
page of just one tool), such as “Top 10 API security tools in 2021”444This is
a made-up example, then we checked all of the referenced tools (and
potentially other referenced lists)

  * •

If the resource is a research paper, we checked if the paper cites other
algorithms that fit our criteria and included them as well

###  III-D Application of inclusion / exclusion criteria

Based on MLR guidelines [9], we defined our inclusion criteria:

  * •

For pages of tools: the tool description directly contains one of the MAPs
from I

  * •

For research papers: the paper proposes a new algorithm/tool to detect a
pattern whose description in the abstract is similar to studied patterns

Moreover, we defined our exclusion criteria as:

  * $\bullet$

Exclusion criterion 1: Non-English results

  * $\bullet$

Exclusion criterion 2: Duplicated result

  * $\bullet$

Exclusion criterion 3: (for papers) The paper proposes a new algorithm/tool to
detect a pattern; however, no source code for the tool is provided

  * $\bullet$

Exclusion criterion 4: (for commercial tools) The tool has no public
documentation of functionality available

  * $\bullet$

Exclusion criterion 5: (for tools) The tool is an all-purpose security tool
claiming to, e.g., “identify over 1000 different vulnerabilities”, i.e., no
particular reference to one of the MAP is given.

  * $\bullet$

Exclusion criterion 6: (for tools) The tool cannot automatically perform the
analysis but requires the programmers to configure it and adapt a certain
workflow first (e.g., configure the tool to detect certain words in commit
messages and then use them in work), so that it cannot be used to
retrospectively analyze the history of an existing project.

###  III-E Evaluation of the quality and credibility of sources

In order to evaluate the credibility and quality of the selected grey
literature sources and to decide whether to include a grey literature source
or not, we extended and applied the quality criteria proposed by Garousi et
al. [9], considering the authority of the producer, the methods applied,
objectivity, date, novelty, impact, and outlet control. We adopted the same
evaluation sheet adopted by Peltonen et al. [29].

Two authors assessed each source using the aforementioned criteria, with a
binary or 3-point Likert scale, depending on the criteria themselves. In case
of disagreement, we discussed the evaluation with the third author, which
helped to provide the final assessment.

We finally calculated the average of the scores and rejected grey literature
sources that scored lower than 0.5 on a scale that ranges from 0 to 1.

###  III-F Creation of final pool of sources

Originally, 45 different resources were identified as relevant. After
performing snowballing on papers and lists and filtering all papers and tools
through the exclusion criteria, we had a list of 59 tools.

###  III-G Data Extraction

In order to obtain the list of tools to detect MAPs (RQ1) we extracted the
tool names from the selected sources.

To understand which pattern is detected by the tools (RQ2), firstly, we read
through the tool documentation. There are two sorts of documents available: a
dedicated website and a README file. Few tools have both. After reading the
documentation, we investigated whether this tool recognizes any MAP and
whether it is possible to obtain information about those patterns using this
tool. We couldn’t locate any tool that recognizes MAP on its own because these
MAPs are not commonly well-established yet. However, a few tools disclose data
that can be utilized to develop an insight into MAPs.

We examined each tool by reviewing its documentation to see if it exposed any
information that may be utilized to detect any MAP. When we locate a tool that
can detect a pattern, we map that tool to that pattern.

Lastly, to understand which technique can be adapted to detect MAPs (RQ3), We
manually analyzed each pattern, including those not discovered by tools, and
mapped each pattern to the possible technique. For the techniques, we
considered static and dynamic analysis. For static analysis, we considered
plain code analysis, operation with call graphs, which might require more
advanced algorithms, and mining software repositories which may include
additional information. For dynamic analysis, we considered application log
analysis considering rich logging in the system code (an ideal case) and event
logs (i.e., received from instrumentation with correlation ID [14]). We did
not consider program slicing.

The first two authors both independently examined and mapped each pattern to
the various techniques using their own reasoning. After that, the differing
viewpoints were resolved by consulting with each other as well as the other
authors.

##  IV Results

This section reports the results we obtained following the research
methodology highlighted in Section 4.

As for the tools available to detect MAPs (RQ1), we identified 59 tools from
45 sources. Tables II and III list the tools retrieved (Open Source and
Commercial, respectively), together with their URL, license (for Open Source
tools), languages supported for analysis, and date of the last update (for
Open Source tools). As for the Licenses adopted by OSS projects, the license
indicated in their repository is stated, such as MIT, Apache, etc.; ‘OSS’
refers to tools whose source code is openly available, but no license is added
to the repository; ‘N/A (Free)’ refers to tools that are available for free
(e.g., as a web service), but not in Open Source form, and thus might be
subject to a custom license as well. Different tools can analyze MAPs from the
perspective of different programming languages. Some tools support several
languages. Other tools scan git commits to perform the analysis, and thus
applicable to any language. While other tools either access the APIs under
analysis using the provided endpoints or analyze API specifications in OpenAPI
format, thus the language of implementation doesn’t matter. The language
reported in Table II as ‘Any’ refers to tools that parse source code in a
language-agnostic manner and thus apply to any language.

Table II: OSS tools to detect Microservice API Patterns (RQ1) |  |  |  | Language |
---|---|---|---|---|---
ID | Tool | URL | License | supported | Updated
T1 | API security tools audit | https://apisecurity.io/tools/audit/ | N/A (Free) | REST API | N/A (Active)
T2 | apidiff | bit.ly/3J0FyZN | MIT | Java | 31.10.2021
T3 | Arjun | bit.ly/3uFZoWv | GPL-3.0 | REST API | 29.08.2021
T4 | Astra | bit.ly/3ontBp4 | Apache-2.0 | REST API | 05.04.2019
T5 | Brakeman | bit.ly/3LbQtSo | MIT | Ruby | 30.01.2022
T6 | Coala | bit.ly/3AXgKiw | AGPL-3.0 | Any | 11.06.2021
T7 | code2flow | bit.ly/34w2MYM | MIT | Many (4) | 27.12.2021
T8 | git-secret | git-secret.io | MIT | git | 01.02.2022
T9 | git-semv | bit.ly/34yi1jM | MIT | git | 17.06.2021
T10 | GitVersion | bit.ly/3AVeUi6 | MIT | git | 31.01.2022
T11 | go-semrel-gitlab | bit.ly/3upDINT | MIT | git | 27.10.2019
T12 | GraphQL FBC-CLI | bit.ly/333l57q | OSS | GraphQL | 06.06.2018
T13 | Hikaku | bit.ly/3Hubkhx | Apache-2.0 | REST-API | 19.08.2021
T14 | jgitver | bit.ly/3glahV5 | Apache-2.0 | Java | 30.03.2021
T15 | Kiterunner | bit.ly/3J77eML | AGPL-3.0 | REST API | 10.05.2021
T16 | LAPD | bit.ly/3gl6FlZ | N/A (Free) | Java | 07.09.2013
T17 | magento-semver | bit.ly/3gnWygi | OSL-3.0 | N/A | 19.01.2022
T18 | microservices-antipatterns | bit.ly/3GwBwGJ | Apache-2.0 | Python | 17.12.2019
T19 | modver | bit.ly/32WbY8k | MIT | Go | 16.01.2022
T20 | Mondrian | bit.ly/3rqHkNZ | OSS | PHP | 16.09.2014
T21 | MSA-nose | bit.ly/3sgODXF | OSS | Java | 12.04.2021
T22 | next-ver | bit.ly/3B5EWzq | MIT | git | 09.02.2018
T23 | NodeJS scan | bit.ly/3uqxHkm | GPL-3.0 | Node.js | 31.01.2022
T24 | NoRegrets | bit.ly/3JjDAnF | Apache-2.0 | JavaScript | 02.07.2019
T25 | OpenAPI diff | bit.ly/3oncymY | MIT | REST API | 29.08.2017
T26 | OpenAPI spec validator | bit.ly/3sogwxc | Apache-2.0 | REST API | 28.01.2022
T27 | openapi-lint | bit.ly/3oqUJDA | BSD-3 | REST API | 12.08.2020
T28 | openapilint | bit.ly/3J45Lqs | MIT | REST API | 13.05.2019
T29 | oval | bit.ly/3J466te | MIT | REST API | 26.09.2018
T30 | pact | bit.ly/3gp77Q8 | MIT | REST-API | 03.02.2022
T31 | paramspider | bit.ly/3sf6JZZ | GPL-3.0 | REST API | 12.09.2021
T32 | Prometheus | prometheus.io | Apache-2.0 | Many (5) | 02.02.2022
T33 | prospector | bit.ly/3oo4Zg7 | GPL-2.0 | Python | 01.02.2022
T34 | Public API changes | bit.ly/3gjOKMF | Unlicense | C# | 05.11.2017
T35 | pycallgraph | bit.ly/3uqyZfc | GPL-2.0 | Python | 28.02.2018
T36 | Pyramid OpenAPI3 | bit.ly/3uqbZg5 | MIT | Python | 07.12.2021
T37 | pyramid-swagger | bit.ly/3sfLKqb | BSD-3 | Python | 30.03.2020
T38 | Python Semantic Release | bit.ly/3oo3uyg | MIT | Python | 31.01.2022
T39 | REST API Antip. Inspect. | bit.ly/3GkLhrG | MIT | REST API | 31.03.2021
T40 | schaapi | bit.ly/3J3BcB7 | MIT | Java | 11.02.2019
T41 | secret-detection | bit.ly/3rqsM0N | OSS | Any | 03.08.2020
T42 | semantic-release | bit.ly/3usLkPQ | MIT | git | 18.01.2022
T43 | semantic-versioning-anal. | bit.ly/3HsvgBn | MIT | .NET | 03.11.2021
T44 | semver-config | bit.ly/3GnLpGN | OSS | git | 26.09.2019
T45 | semverbot | bit.ly/3GteoZI | MPL-2.0 | git | 03.01.2022
T46 | Speccy | bit.ly/3uknqGe | MIT | REST API | 02.10.2019
T47 | Spectral | bit.ly/3gnIeo3 | Apache-2.0 | REST API | 03.02.2022
T48 | SpotBugs | bit.ly/3glbvQj | LGPL-2.1 | Java | 29.01.2022
T49 | Standard Version | bit.ly/3uqgx64 | ISC | Node.js | 01.01.2022
T50 | Vulture | bit.ly/3Gq9hd2 | MIT | Python | 03.01.2022
T51 | wFuzz | bit.ly/3opt5Hg | GPL-2.0 | REST API | 28.11.2020
T52 | Zally | bit.ly/34lLHkq | MIT | REST API | 14.01.2022
Table III: Commercial tools to detect Microservice API Patterns (RQ1) ID | Tool | URL | Supported Languages
---|---|---|---
T53 | Acunetix | acunetix.com | Web
T54 | CheckMarx | checkmarx.com | Many (20)
T55 | CodeClimate | bit.ly/3GrqB12 | Many (11)
T56 | Data Theorem API Secure | bit.ly/34ASaYM | N/A
T57 | Dynatrace | dynatrace.com | Many
T58 | SonarQube* | bit.ly/3GryR15 | Many (29)
T59 | Synopsys | bit.ly/3uqjhRd | REST API
*Dual-licensed, available both as commercial and open source (GPL).

There are 7 Commercial tools and 52 OSS tools to provide some summary
statistics.

When it comes to OSS licenses, 33 of tools (56% of total tools) are using
permissive licenses (Apache, MIT, BSD, etc.), and 5 more use no license at
all, while 7 tools (11%) use ‘copyleft’ licenses (different versions of GPL
license).

In terms of languages, 16 tools (27%) are written in Python, 11 tools (19%)
are written in JavaScript (some of them in TypeScript), Java and Go have 6
tools each (10% each); other represented languages are C++/C#, Kotlin, PHP and
shell scripting (bash).

Supported languages/platforms involve 8 tools analyzing commits in Git (14%),
another 8 tools targeting Python as the only language (13%), 6 tools (10%)
targeting Java, and another 6 tools (10%) supporting several languages. Also,
19 tools (32%) target REST APIs directly, with 9 analyzing specifications and
10 using the endpoints dynamically.

Out of 52 OSS tools, 32 have been updated at least once since January 2021.
Furthermore, 19 have been updated already in 2022.

It should also be noted that some tools are research prototypes (T2, T16, T18,
T21), some grew out of research prototypes (T48), while many are projects done
by hobbyists (T19, T34, T37 to name a few), so their quality and applicability
to up-to-data languages and frameworks could be limited. The scope of this
paper is simply to identify existence of _some_ tools to address MAPs and see
the pattern coverage, assessing the actual quality and usefulness of the tools
is a different, much more complicated endeavour.

As for the MAPs that can be detected automatically with tools (RQ2), we found
26 tools that expose information about the tools. These tools are listed as
RQ2 column in Table IV. Our table shows that found tools detect a subset of
all patterns, and a combination of tools is necessary to address broader
coverage. For example, the pattern ‘API Description’ is detected by 9 tools in
the Foundation category, while no tool targets the other 5 patterns in this
category. Two tools, code2flow, and pycallgraph, which are both based on call
graphs, can identify all of the patterns in the Responsibility category.
Hikaku is a tool that can be used to detect all of the patterns in the
Structure category. All of the patterns in this category, with the exception
of ‘Context representation,’ can be discovered with four or more tools. There
are three patterns in the quality section that no tool can detect. Rate Plan,
Service Level Agreement, and Wish Template are examples of these patterns. At
least one tool detects the rest of the patterns. Three patterns are not
detected by any tools in the Evolution category, whereas four patterns are
detected by at least three tools.

The most promising techniques to detect MAPs (RQ3) stem from the static
analysis involving source code analysis as detailed in Table IV. Most of the
tools we found use static analysis. In particular, the static analysis might
need to determine call graphs to detect certain patterns, and also, the
detection process can use mining software repositories. Nevertheless, given
the API level, dynamic analysis can also determine a large number of patterns.
While application log analysis is one option, it is a challenging option
dependent on the level of logging. It is more convenient to use event logs
resulting from recent cloud-native frameworks and infrastructure advancements.
All events are centralized and aggregated by the occurrence time, with
correlation ID indicating message dependencies.

Table IV: Possible Techniques for detecting microservice patterns | RQ2 | RQ3
---|---|---
Patterns | Detected by tool (ID) | Static | Dynamic
|  | Analysis | Analysis
|  |  Call Graph |  Source Code |  Repository |  Event Log |  Application log
Foundation
Frontend integration |  | ✓ | ✓ |  | ✓ | ✓
Backend integration |  | ✓ | ✓ |  |  |
Public API |  |  |  |  |  |
Community API |  |  |  |  |  |
Solution Internal API |  |  |  |  |  |
API Description | T25, T26, T27, T28, T29, T36, T37, T46, T52 |  | ✓ |  |  |
Responsibility
Processing resource | T7, T35 | ✓ | ✓ |  | ✓ | ✓
Information holder resource | T7, T35 | ✓ | ✓ |  | ✓ | ✓
Computation function | T7, T35 | ✓ | ✓ |  | ✓ | ✓
State recreation operation | T7, T35 | ✓ | ✓ |  | ✓ | ✓
Retrieval operation | T7, T35 | ✓ | ✓ |  | ✓ | ✓
State transition operation | T7, T35 | ✓ | ✓ |  | ✓ | ✓
Operational Data Holder | T7, T35 | ✓ | ✓ |  | ✓ | ✓
Master data holder | T7, T35 | ✓ | ✓ |  | ✓ | ✓
Reference data holder | T7, T35 | ✓ | ✓ |  | ✓ | ✓
Data transfer resource | T7, T35 | ✓ | ✓ |  | ✓ | ✓
Link Lookup resource | T7, T35 | ✓ | ✓ |  | ✓ | ✓
Structure
Atomic parameter | T3, T6, T13, T31, T36, T37 |  | ✓ |  |  |
Atomic parameter list | T3, T6, T13, T31, T36, T37 |  | ✓ |  |  |
Parameter tree | T3, T6, T13, T31, T36, T37 |  | ✓ |  |  |
Parameter forest | T3, T6, T13, T31, T36, T37 |  | ✓ |  |  |
Data element | T6, T13, T31, T36, T37 |  | ✓ |  |  |
Id element | T3, T6, T13, T31, T36, T37 |  | ✓ |  |  |
Link element | T6, T13, T31, T36, T37 |  | ✓ |  |  |
Metadata element | T13, T31, T36, T37 |  | ✓ |  |  |
Context representation | T13 |  | ✓ |  |  |
Pagination | T13, T31, T36, T37 |  | ✓ |  | ✓ | ✓
Quality
API key | T13, T36, T37 |  | ✓ |  | ✓ | ✓
Rate limit | T36, T37, T53 |  | ✓ |  | ✓ | ✓
Rate plan |  |  |  |  |  |
Service level agreement |  |  |  |  |  |
Error report | T13, T36, T37 | ✓ | ✓ |  | ✓ | ✓
Conditional request | T13, T36, T37 | ✓ | ✓ |  | ✓ | ✓
Request bundle | T13 | ✓ | ✓ |  | ✓ | ✓
Wish list | T36, T37 | ✓ | ✓ |  | ✓ | ✓
Wish template |  | ✓ | ✓ |  | ✓ | ✓
Embedded entity | T13 | ✓ | ✓ |  | ✓ | ✓
Linked information holder | T13 | ✓ | ✓ |  | ✓ | ✓
Evolution
Version identifier | T6, T10, T13, T45 |  | ✓ | ✓ | ✓ |
Semantic versioning | T2, T9, T13, T19, T38, T40, T42, T43, T44, T45 |  | ✓ | ✓ | ✓ |
Two in production |  |  | ✓ | ✓ | ✓ |
Aggresive obsolesense |  | ✓ | ✓ | ✓ | ✓ |
Experimental preview |  |  | ✓ | ✓ | ✓ |
Limited lifetime guarantee | T2, T13, T40 |  | ✓ |  |  |
Eternal lifetime guarantee | T2, T13, T40 |  | ✓ |  |  |

##  V Discussion

It is interesting to note that the vast majority of MAPs can be detected by
tools, even if there are no tools that analyze them all. Foundation patterns
are the only group of MAPs where no tools implemented their detection, except
for the ”API description.” However, few other patterns could be technically
detected, and therefore tools could implement them. Other pattern categories
have rather reasonable coverage by tools.

Regarding RQ1, we found 59 tools available for the detection task. We listed
these tools in Tables II and III. These tables also divided the tools based on
open-source availability. We further categorized these tools based on patterns
they identify in Table IV. However, not all tools had available information on
which patterns they could detect.

With regards to RQ2, almost no tool identifies the patterns directly. The
extracted results must be post-interpreted by users to identify these patterns
from the provided information. For example, tools discovering the pattern
’Semantic Versioning Identifier’ do not simply tell if the project has
followed the SemVer specification555www.semver.org, but instead tell the
correct identifier (increment) based on changes in the source, and it is up to
the developer/researcher to compare it to the one actually used. This is a
missing step to better terminology unification, establishment, and automation
in the domain, which some practitioners could desire. Still, there are notable
gaps and improvement opportunities. Despite 59 tools found, there is no
outstanding tool with respect to the detection coverage of a number of
patterns. Tools must be combined to address different types of patterns. Table
IV outlines identified gaps that quality assurance tools should fill to
provide better quality measures through integration into a single solution.
Some conventional API testing tools could be used to detect specific patterns,
but we excluded such tools as they need explicit scripting. As an example, in
Postman [30], it is possible to extract request/response headers from HTTP
calls, and from the headers, users can write tests to see if it contains API
Key or Version information, etc.

Related to RQ3, identified tools are predominantly based on static code
analysis, and more advanced techniques might be necessary to detect some
patterns as depicted by Table IV. This table also shows that some patterns
that could be detected by the techniques we identified are not yet recognized
by the pool of tools we found, which opens opportunities. Some of the patterns
currently require manual input to be determined. However, this opens questions
about whether other techniques could be considered to address these patterns.
For instance, _“Rate Plan”_ and _“SLA”_ are about the legal use of the API,
and perhaps organizational policies need to be taken into account. Still,
these policies are not in a machine-readable format, and there is no guarantee
these are enforced; thus, more advanced mechanisms would need to be considered
to allow combinations of static or dynamic analysis with organizational
policies.

The results of this work can be useful for researchers that can investigate
different techniques for detecting patterns. This paper’s outcomes could also
be useful to practitioners who can access the list of tools that automatically
detect patterns and eventually integrate them in continuous quality control
models [31]. Finally, results might be beneficial to tool providers that might
extend their solutions to detect a large number of patterns or integrate them
into DevOps pipelines [32].

##  VI Threats to Validity

Systematic reviews and surveys often suffer from several threats to validity.
We discuss the threats considering construct, internal, external, and
conclusions validity.

The construct validity is meant to consider the research questions within the
investigated area. Our queries are motivated by gaps in related works. The
search terms combined established terms and pattern names commonly recognized
in the community and domain of this work. We addressed a possible threat of
omitting relevant research from our review by experimenting with several other
search strings identifying related work. The analyzed sample considered grey
literature articles to ensure the up-to-date perspective of practitioners.
Furthermore, our evidence search was often limited to an abstract overview of
sources, which could miss relevant work.

Internal validity involves methods to study and analyze data (e.g., the types
of bias involved). One potential threat is related to inclusion and exclusion,
a process that includes metadata. Besides, our bias could affect the
filtering. Multiple authors performed this search, with primary authors
assigned to particular patterns and secondary authors spot-checking. Apart
from the filtering process, we performed tool localization by name,
documentation, and repository identification if available. Our approach to
taxonomy is a result of our discussions of interpreted results and represents
our view on the identified literature and domain.

External validity is related to knowledge generalization. This survey
interprets and categorizes works we gathered from established scientific
channels and grey literature along with our experience related to the field.
We could have missed related work on specific patterns or related tools
because of our selection of search strings, part of which target specific
patterns or groups of patterns. However, even with a subset of identified
tools and approaches, we would likely have identified common techniques
applied for pattern mining and provided an overview of what has been
accomplished and which gaps remain to be addressed.

The conclusions resulting from several brainstorming sessions were
independently settled and agreed on by all authors. To address the validity of
the conclusions, we involved multiple authors in this study with diverse
backgrounds, all discussing the outcomes in the context of extracted and
synthesized information.

##  VII Conclusion

This paper considered microservice API patterns (MAP) and their recognition by
available quality assurance tools. It provides a practical road map to what
tools and open-source exits to detect these patterns and where the gaps
remain. We have identified 59 tools that address 34 MAPs out of 46 identified.
We did not find a specific tool that would surpass others, and thus a
combination of tools is necessary to cover a broader spectrum of MAPs. Yet,
not complete coverage exists considering our search results. This gap
represents an opportunity for the community to combine and integrate efforts
to provide better quality assurance tools needed in this mainstream field.
Furthermore, considering that we identified many open source projects, their
integration is a logical next step to developing a more advanced microservice
infrastructure for quality assurance.

## Acknowledgments

This material was supported by the ADOMS Grant awarded by the Ulla Tuominen
Foundation (Finland), National Science Foundation under Grant No. 1854049 and
a grant from Red Hat Research https://research.redhat.com.

## References

  * [1] F. Wedyan and S. Abufakher, “Impact of design patterns on software quality: a systematic literature review,” _IET Software_ , vol. 14, no. 1, pp. 1–17, 2020.
  * [2] D. Taibi, V. Lenarduzzi, and C. Pahl, “Architectural patterns for microservices: A systematic mapping study,” in _Proceedings of the 8th International Conference on Cloud Computing and Services Science - Volume 1: CLOSER,_ , INSTICC. SciTePress, 2018, pp. 221–232.
  * [3] O. Zimmermann, M. Stocker, D. Lübke, C. Pautasso, and U. Zdun, “Introduction to microservice api patterns (map),” in _International Conference on Microservices (Microservices 2019)_ , 2019.
  * [4] A. Wiggins, “The twelve-factor app,” 2017, (Accessed on 10/02/2021). [Online]. Available: {https://12factor.net/}
  * [5] J. Lewis and M. Fowler, “Microservices,” www.martinfowler.com/articles/microservices.html, Accessed: January 2022, March 2014.
  * [6] S. Newman, _Building Microservices_. O’Reilly Media, Inc., 2015.
  * [7] T. Cerny, J. Svacina, D. Das, V. Bushong, M. Bures, P. Tisnovsky, K. Frajtak, D. Shin, and J. Huang, “On code analysis opportunities and challenges for enterprise systems and microservices,” _IEEE Access_ , pp. 1–22, 2020.
  * [8] J. Soldani, G. Muntoni, D. Neri, and A. Brogi, “The $\mu$tosca toolchain: Mining, analyzing, and refactoring microservice‐based architectures,” _Software: Practice and Experience_ , vol. 51, pp. 1591 – 1621, 2021.
  * [9] V. Garousi, M. Felderer, and M. V. Mäntylä, “Guidelines for including grey literature and conducting multivocal literature reviews in software engineering,” _Information and Software Technology_ , vol. 106, pp. 101 – 121, 2019.
  * [10] S. Panichella, M. R. Imranur, and D. Taibi, “Structural coupling for microservices,” in _11th International Conference on Cloud Computing and Services Science_ , 04 2021.
  * [11] I. Pigazzini, F. Arcelli Fontana, V. Lenarduzzi, and D. Taibi, “Towards microservice smells detection,” in _Proceedings of the 3rd International Conference on Technical Debt_ , ser. TechDebt ’20, 2020, p. 92–97.
  * [12] A. K. Dwivedi, A. Tirkey, and S. K. Rath, “Software design pattern mining using classification-based techniques,” _Frontiers of Computer Science_ , vol. 12, no. 5, pp. 908–922, 2018.
  * [13] M. A. de F. Farias, R. Novais, M. C. Júnior, L. P. da Silva Carvalho, M. Mendonça, and R. O. Spínola, “A systematic mapping study on mining software repositories,” in _Proceedings of the 31st Annual ACM Symposium on Applied Computing_ , ser. SAC ’16, 2016, p. 1472–1479.
  * [14] J. Carnell and I. H. Sánchez, _Spring microservices in action_. Simon and Schuster, 2021.
  * [15] A. Balalaie, A. Heydarnoori, P. Jamshidi, D. A. Tamburri, and T. Lynn, “Microservices migration patterns,” _Software: Practice and Experience_ , vol. 48, no. 11, pp. 2019–2042, 2018.
  * [16] D. Taibi, N. El Ioini, P. Claus, and J. R. S. Niederkofler, “Patterns for serverless functions (function-as-a-service): A multivocal literature review,” in _10th International Conference on Cloud Computing and Services Science (CLOSER)_ , 2020, pp. 181–192.
  * [17] O. Zimmermann, “Microservice api patterns,” https://www.microservice-api-patterns.org/, accessed: 2022-02-04.
  * [18] O. Zimmermann, M. Stocker, D. Lübke, C. Pautasso, and U. Zdun, “Introduction to Microservice API Patterns (MAP),” in _Joint Post-proceedings of the First and Second International Conference on Microservices (Microservices 2017/2019)_ , 2020, pp. 4:1–4:17.
  * [19] O. Zimmermann, D. Lübke, U. Zdun, C. Pautasso, and M. Stocker, “Interface responsibility patterns: Processing resources and operation responsibilities,” in _European Conference on Pattern Languages of Programs 2020_ , ser. EuroPLoP ’20, 2020.
  * [20] O. Zimmermann, C. Pautasso, D. Lübke, U. Zdun, and M. Stocker, “Data-oriented interface responsibility patterns: Types of information holder resources,” ser. EuroPLoP ’20, 2020.
  * [21] D. Lübke, O. Zimmermann, C. Pautasso, U. Zdun, and M. Stocker, “Interface evolution patterns: Balancing compatibility and extensibility across service life cycles,” in _Proceedings of the 24th European Conference on Pattern Languages of Programs_ , ser. EuroPLop ’19. New York, NY, USA: Association for Computing Machinery, 2019.
  * [22] M. Stocker, O. Zimmermann, D. Lübke, U. Zdun, and C. Pautasso, “Interface quality patterns – communicating and improving the quality of microservices apis,” in _23rd European Conference on Pattern Languages of Programs 2018_ , July 2018.
  * [23] O. Zimmermann, M. Stocker, D. Lübke, and U. Zdun, “Interface representation patterns - crafting and consuming message-based remote apis,” in _22nd European Conference on Pattern Languages of Programs (EuroPLoP 2017)_ , July 2017, pp. 1–36.
  * [24] V. Bushong, A. S. Abdelfattah, A. A. Maruf, D. Das, A. Lehman, E. Jaroszewski, M. Coffey, T. Cerny, K. Frajtak, P. Tisnovsky, and M. Bures, “On microservice analysis and architecture evolution: A systematic mapping study,” _Applied Sciences_ , vol. 11, no. 17, 2021.
  * [25] D. Taibi and K. Systä, “From monolithic systems to microservices: A decomposition framework based on process mining,” in _Proceedings of the 9th International Conference on Cloud Computing and Services Science (CLOSER)_ , INSTICC. SciTePress, 2019, pp. 153–164.
  * [26] V. Bushong, R. Sanders, J. Curtis, M. Du, T. Cerny, K. Frajtak, P. Tisnovsky, and D. Shin, “On log analysis and stack trace use to improve program slicing,” in _Information Science and Applications_. Springer Singapore, December 2021, p. (in print).
  * [27] X. Zhao, Y. Zhang, D. Lion, M. F. Ullah, Y. Luo, D. Yuan, and M. Stumm, “lprof: A non-intrusive request flow profiler for distributed systems,” in _11th USENIX Symposium on Operating Systems Design and Implementation (OSDI 14)_ , Broomfield, CO, 2014, pp. 629–644.
  * [28] “Open Telemetry,” 2022. [Online]. Available: https://opentelemetry.io
  * [29] S. Peltonen, L. Mezzalira, and D. Taibi, “Motivations, benefits, and issues for adopting micro-frontends: A multivocal literature review,” _Information and Software Technology_ , vol. 136, p. 106571, 2021.
  * [30] “Postman api platform,” 2022. [Online]. Available: https://www.postman.com/
  * [31] V. Lenarduzzi, A. C. Stan, D. Taibi, D. Tosi, and G. Venters, “A dynamical quality model to continuously monitor software maintenance,” in _11th European Conference on Information Systems Management (ECISM2017)_ , 2017.
  * [32] D. Taibi, V. Lenarduzzi, and C. Pahl, “Continuous architecting with microservices and devops: A systematic mapping study,” in _Cloud Computing and Services Science (CLOSER)_ , 2019, pp. 126–151.