SlideShare a Scribd company logo
1 of 88
Download to read offline
FA S T P H P A P I
W H O A M I
Simone Di Maulo - aka @toretto460
PUGGER
http://toretto.me
A G E N D A
A G E N D A
ā€¢ Performance
A G E N D A
ā€¢ Performance
ā€¢ HTTP
A G E N D A
ā€¢ Performance
ā€¢ HTTP
ā€¢ DB Performance
A G E N D A
ā€¢ Performance
ā€¢ HTTP
ā€¢ DB Performance
ā€¢ Heavy load tasks
A G E N D A
ā€¢ Performance
ā€¢ HTTP
ā€¢ DB Performance
ā€¢ Heavy load tasks
R E S P O N S E T I M E X m s
ā€” D O N A L D K N U T H ā€”
ā€œ S T R U C T U R E D P R O G R A M M I N G W I T H G O T O S TAT E M E N T S ā€
[ā€¦] premature optimization is the root of all evil.
ā€” D O N A L D K N U T H ā€”
ā€œ S T R U C T U R E D P R O G R A M M I N G W I T H G O T O S TAT E M E N T S ā€
[ā€¦] premature optimization is the root of all evil.
K E E P I N
M I N D
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
L O A D T E S T S
A PA C H E B E N C H M A R K
ab -n 200 -c 50 -k -g bench.tsv http://my.api.test/v1/pro...
^[1] ^[2] ^[3] ^[4] ^[5]
1. Number of requests
2. Concurrent requests
3. Use the keep-alive connection
4. Write the output ready for gnuplot
5. The URL to call
A PA C H E B E N C H M A R K
## Graph configuration ##
# Set the output format and size
set terminal jpeg size 1280,800
# Set the aspect ratio
set size 1, 1
# Title
set title "Benchmark testing"
# The legend/key position
set key left top
# Draw gridlines on the y axis
set grid y
# Label the x-axis
set xlabel 'seconds'
# Label the y-axis
set ylabel "response time (ms)"
## I/O Configuration
# Specify that the x-series data is time data
set xdata time
# The output file
set output "bench.jpg"
# Specify the *input* format of the time data
set timefmt "%s"
# Specify the *output* format for the x labels
set format x "%S"
# Use tabs as the delimiter instead of spaces
set datafile separator 't'
## Run the Plot
# Plot the data
plot "bench.tsv" every ::2 using 2:5 with points
exit
gnuplot plot.format
ā€¢ https://blackfire.io
ā€¢ https://tideways.io
ā€¢ http://xhprof.io/
ā€¢ https://symfony.com/doc/current/cookbook/profiler/
index.html
A G E N D A
ā€¢ Performance
ā€¢ HTTP
ā€¢ DB Performance
ā€¢ Heavy load tasks
HTTP is a ā€œcontractā€
H T T P I S Y O U R F R I E N D
STATELESS ā¤ ORIZONTAL SCALABILITY
CACHING ā¤ PERFORMANCE
COMPRESSION ā¤ SLOW MOBILE NETWORKS
C A C H I N G
$ curl -I http://my-api.com/users/toretto460
$ curl -I http://my-api.com/users/toretto460
{
ā€œidā€: da34gtyu50-lo983,
ā€œusernameā€: ā€œtoretto460ā€,
. . .
}
$ curl -I http://my-api.com/users/toretto460
{
ā€œidā€: da34gtyu50-lo983,
ā€œusernameā€: ā€œtoretto460ā€,
. . .
}
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Sat, 28 Jul 2015 20:12:45 GMT
Cache-Control: private max-age=600
ETag: 88493f3-4afd-507dd8e0aa030
{
ā€œidā€: da34gtyu50-lo983,
ā€œusernameā€: ā€œtoretto460ā€,
. . .
}
$ curl -I http://my-api.com/users/toretto460
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Sat, 28 Jul 2015 20:12:45 GMT
Cache-Control: private max-age=600
ETag: 88493f3-4afd-507dd8e0aa030
{
ā€œidā€: da34gtyu50-lo983,
ā€œusernameā€: ā€œtoretto460ā€,
. . .
}
$ curl -I http://my-api.com/users/toretto460
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Sat, 28 Jul 2015 20:12:45 GMT
Cache-Control: private max-age=600
ETag: 88493f3-4afd-507dd8e0aa030
{
ā€œidā€: da34gtyu50-lo983,
ā€œusernameā€: ā€œtoretto460ā€,
. . .
}
$ curl -I http://my-api.com/users/toretto460
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Sat, 28 Jul 2015 20:12:45 GMT
Cache-Control: private max-age=600
ETag: 88493f3-4afd-507dd8e0aa030
{
ā€œidā€: da34gtyu50-lo983,
ā€œusernameā€: ā€œtoretto460ā€,
. . .
}
$ curl -I http://my-api.com/users/toretto460
HTTP/1.1 200 OK
Connection: keep-alive
Content-Type: application/json; charset=utf-8
Date: Sat, 28 Jul 2015 20:12:45 GMT
Cache-Control: private max-age=600
ETag: 88493f3-4afd-507dd8e0aa030
Avoid same request until 28 Jul 2015 20:22:45 GMT
THE SYMFONY WAY
P L AY W I T H H E A D E R S
public function getAction($userIdentifier, Request $request)
{
$response = new Response();
$user = $this->fetchUser($userIdentifier);
$response->setETag($user->caclulateETag());
// $response->setLastModified($user->getLastUpdateDate());
if ($response->isNotModified($request)) {
return $response;
}
...
}
T O O M U C H
M A G I C I N S I D E
https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/http-caching
D ATA C O M P R E S S I O N
HTTP Compression is a set of rules
defined by the protocol which enable network
entities (Client and Server) to exchange
compressed data.
# Apache Configuration File
# ------------------------------------------------------------------------------
# | Compression |
# ------------------------------------------------------------------------------
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/javascript 
application/json 
text/css 
text/html 
text/plain 
text/xml
</IfModule>
</IfModule>
E N A B L E C O M P R E S S I O N
# Apache Configuration File
# ------------------------------------------------------------------------------
# | Compression |
# ------------------------------------------------------------------------------
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
DeflateFilterNote Input input_info
DeflateFilterNote Output output_info
DeflateFilterNote Ratio ratio_info
LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate
CustomLog /var/log/apache2/deflate_log deflate
</IfModule>
</IfModule>
L O G C O M P R E S S I O N
H T T P C O M P R E S S I O N
GET /users/toretto460 HTTP/1.1
Host: www.example.com
Accept-Encoding: gzip, deflate
HTTP/1.1 200 OK
Date: mon, 27 Jul 2015 22:38:34 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Accept-Ranges: bytes
Content-Length: 438
Connection: close
Content-Type: text/html; charset=UTF-8
Content-Encoding: gzip
H T T P C O M P R E S S I O N
GET /users/toretto460 HTTP/1.1
Host: www.example.com
HTTP/1.1 200 OK
Date: mon, 27 Jul 2015 22:38:34 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Accept-Ranges: bytes
Content-Length: 438
Connection: close
Content-Type: text/html; charset=UTF-8
Accept-Encoding: gzip, deflate
Content-Encoding: gzip
T H E P O W E R O F H T T P
Client ServerISP Proxy
T H E P O W E R O F H T T P
Client ServerISP Proxy
Client cache
T H E P O W E R O F H T T P
Client ServerISP Proxy
Client cache
Public cache
T H E P O W E R O F H T T P
Client ServerISP Proxy
Client cache
Public cache
Reverse Proxy
Data compression
A G E N D A
ā€¢ Performance
ā€¢ HTTP
ā€¢ DB Performance
ā€¢ Heavy load tasks
O R M H E R O
T I P S
ā€¢ AUTO_INCREMENT / SEQUENCE are not so cheap
ā€¢ Understanding the TRACKING POLICY
ā€¢ Use READONLY entities
ā€¢ Letā€™s CACHE
A U T O _ I N C R E M E N T & S E Q U E N C E S
A R E N O T S O C H E A P
class User
{
/**
* @ORMId
* @ORMColumn(name="ID", type="string", length=37, nullable=false)
* @ORMGeneratedValue(strategy="AUTO")
*/
private $id;
}
A U T O _ I N C R E M E N T & S E Q U E N C E S
A R E N O T S O C H E A P
class User
{
/**
* @ORMId
* @ORMColumn(name="ID", type="string", length=37, nullable=false)
* @ORMGeneratedValue(strategy="AUTO")
*/
private $id;
public function __construct(UserInfoDTO $userInfo)
{
$this->id = (string) Uuid::uuid4();
$this->name = $userInfo->name;
...
}
}
U N D E R S TA N D I N G T H E
T R A C K I N G P O L I C Y
U N D E R S TA N D I N G T H E
T R A C K I N G P O L I C Y
ā€” M A R T I N F O W L E R ā€”
ā€œMaintains a list of objects affected by a business
transaction
and coordinates the writing out of changes and the
resolution of concurrency problems.ā€
UNIT OF WORK
U N I T O F W O R K
D ATA B A S E
$em->persist($user);
U N I T O F W O R K
D ATA B A S E
$em->persist($user);
U N I T O F W O R K
D ATA B A S E
$em->persist($user);
U N I T O F W O R K
$em->flush();
D ATA B A S E
TRACKING POLICIES
D E F E R R E D I M P L I C I T
With this policy, Doctrine detects the changes by a
property-by-property comparison at commit time and
also detects changes to entities or new entities that are
referenced by other managed entities ā€¦
http://doctrine-orm.readthedocs.org/en/latest/reference/change-tracking-policies.html
D E F E R R E D I M P L I C I T
http://doctrine-orm.readthedocs.org/en/latest/reference/change-tracking-policies.html
class User
{
/**
* @ORMId
* @ORMColumn(name="ID", type="string", length=37, nullable=false)
*/
private $id;
/**
* @ORMColumn(name="FIRST_NAME", type="string", length=100, nullable=false)
*/
private $firstName;
/**
* @ORMColumn(name="LAST_NAME", type="string", length=100, nullable=false)
*/
private $lastName;
/**
* @ORMColumn(name="BIRTH_DATE", type="date", nullable=false)
*/
private $birthDate;
}
UOW
$em->flush();
D E F E R R E D E X P L I C I T
ā€¦ the difference is that Doctrine 2 only considers
entities that have been explicitly marked for change
detection through a call to
EntityManager::persist(entity)
or through a save cascade.
http://doctrine-orm.readthedocs.org/en/latest/reference/change-tracking-policies.html
D E F E R R E D E X P L I C I T
http://doctrine-orm.readthedocs.org/en/latest/reference/change-tracking-policies.html
class User
{
/**
* @ORMId
* @ORMColumn(name="ID", type="string", length=37, nullable=false)
*/
private $id;
/**
* @ORMColumn(name="FIRST_NAME", type="string", length=100, nullable=false)
*/
private $firstName;
/**
* @ORMColumn(name="LAST_NAME", type="string", length=100, nullable=false)
*/
private $lastName;
/**
* @ORMColumn(name="BIRTH_DATE", type="date", nullable=false)
*/
private $birthDate;
}
UOW
$em->persist($user);
$em->flush();
N O T I F Y
This policy is based on the assumption that the entities
notify interested listeners of changes to their properties.
For that purpose, a class that wants to use this policy
needs to implement the NotifyPropertyChanged
interface
http://doctrine-orm.readthedocs.org/en/latest/reference/change-tracking-policies.html
N O T I F Y
<?php
use DoctrineCommonNotifyPropertyChanged,
DoctrineCommonPropertyChangedListener;
/**
* @Entity
* @ChangeTrackingPolicy("NOTIFY")
*/
class User implements NotifyPropertyChanged
{
// ...
private $_listeners = array();
public function addPropertyChangedListener(PropertyChangedListener $listener)
{
$this->_listeners[] = $listener;
}
}
N O T I F Y
<?php
// . . .
protected function _onPropertyChanged($propName, $oldValue, $newValue)
{
if ($this->_listeners) {
foreach ($this->_listeners as $listener) {
$listener->propertyChanged($this, $propName, $oldValue, $newValue);
}
}
}
public function setData($data)
{
if ($data != $this->data) {
$this->_onPropertyChanged('data', $this->data, $data);
$this->data = $data;
}
}
}
U S E R E A D O N LY E N T I T I E S
This means that the entity marked as read only is never
considered for updates
U S E R E A D O N LY E N T I T I E S
/**
* @ORMEntity(readOnly=true)
*/
class NewsTag
{
/**
* @ORMId
* @ORMColumn(name="ID", type="string", length=37, nullable=false)
*/
private $id;
}
L E T ā€™ S C A C H E
/**
* Configure the Doctrine ORM with a result cache provider.
*/
$config = new DoctrineORMConfiguration();
// The APC way
$apcCacheDriver = new DoctrineCommonCacheApcCache();
$config->setResultCacheImpl($apcCacheDriver);
// The memcache way
$memcache = new Memcache();
$memcache->connect('memcache_host', 11211);
$memCacheDriver = new DoctrineCommonCacheMemcacheCache();
$memCacheDriver->setMemcache($memcache);
$config->setResultCacheImpl($memCacheDriver);
L E T ā€™ S C A C H E
doctrine:
orm:
metadata_cache_driver: apc
query_cache_driver: apc
result_cache_driver:
type: memcache
host: localhost
port: 11211
L E T ā€™ S C A C H E
class UserRepository
{
/**
* @return User[]
*/
protected function findLocked()
{
$qb = $this->createQueryBuilder('user');
$qb->where($qb->expr()->eq('user.locked', true));
$query = $qb->getQuery();
$query->useResultCache(true, 60 * 2 /* 2 minutes */);
return $query->getResult();
}
}
R E A L U S E C A S E - # 1 D ATA I M P O R T
> 2 0 0 K E N T I T I E S
SEQUENCE UUID
$em->flush(get_class($entity));
$em->clear(get_class($entity));
R E A L U S E C A S E - # 1 D ATA I M P O R T
> 2 0 0 K E N T I T I E S
R E A L U S E C A S E - # 1 D ATA I M P O R T
> 2 0 0 K E N T I T I E S
208k Entities
loaded in 2h 25m
šŸ˜Ÿ
R E A L U S E C A S E - # 1 D ATA I M P O R T
> 2 0 0 K E N T I T I E S
R E A L U S E C A S E - # 1 D ATA I M P O R T
> 2 0 0 K E N T I T I E S
AFTER THE CURE
208k Entities
loaded in 28 minutes
šŸ˜Š
A G E N D A
ā€¢ Performance
ā€¢ HTTP
ā€¢ DB Performance
ā€¢ Heavy load tasks
S L O W TA S K
The user avatar should be resized to 300x300px
The administrator should upload up to 250k
orders in a single cvs file
Send an email when a new post has been created
S L O W TA S K
A crawler should find and aggregate product info
Every X minutes the rss feed should be updated
The user can export all the orders
R E A L U S E C A S E - # 2 R E P O R T I N G
R E A L U S E C A S E - # 2 R E P O R T I N G
AS AN analyst
I WANT TO request for a new monthly report
R E A L U S E C A S E - # 2 R E P O R T I N G
AS AN analyst
I WANT TO request for a new monthly report
CREATE TABLE TMP_CFMS_R7_7844 AS SELECT ROWNUM AS ID, x.* FROM (SELECT COD_DEALER, COD_PDV, TOTAL_ACQUISIZIONI,
CONFRONTO_ACQUISIZIONI, AVG_ACQUISIZIONI, PERCENTUALE_INCREMENTO, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS
NUMBER ) QTA_SUPE_SOGL, TOTAL_SOSPENSIONI, SOSPENSIONI_CONFRONTO, AVG_SOSPENSIONI, PERCENTUALE_INCREMENTO_SOSP,
CAST( NULL AS NUMBER ) QTA_SOGL_SOSP, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL_SOSP, PERCENTUALE_SOSPENSIONI_ACQU,
PERC_SOSP_ACQU_CONF, PERCENTUALE_SUPERAMENTO, D_RAG_SOC, D_IND, D_LOCALITA, D_CAP, D_PROVINCIA, D_PIVA, INDIRIZZO
V_IND, LOCALITA V_LOCALITA, CAP V_CAP, PROVINCIA V_PROVINCIA FROM ANAGRAFICA_DEALER, (SELECT COD_DEALER, COD_PDV,
TOTAL_ACQUISIZIONI, CONFRONTO_ACQUISIZIONI, AVG_ACQUISIZIONI, PERCENTUALE_INCREMENTO, CAST( NULL AS NUMBER )
QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL, TOTAL_SOSPENSIONI, SOSPENSIONI_CONFRONTO, AVG_SOSPENSIONI,
PERCENTUALE_INCREMENTO_SOSP, CAST( NULL AS NUMBER ) QTA_SOGL_SOSP, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL_SOSP,
PERCENTUALE_SOSPENSIONI_ACQU, PERC_SOSP_ACQU_CONF, PERCENTUALE_SUPERAMENTO, RAGSOC D_RAG_SOC, INDIRIZZO D_IND,
LOCALITA D_LOCALITA, CAP D_CAP, PROVINCIA D_PROVINCIA, PIVA D_PIVA FROM ANAGRAFICA_DEALER, (SELECT
A.COD_DEALER,A.COD_PDV,NVL(A.TOTAL_ACQUISIZIONI,'0') TOTAL_ACQUISIZIONI,NVL(A.CONFRONTO_ACQUISIZIONI,'0')
CONFRONTO_ACQUISIZIONI,NVL(B.AVG_ACQUISIZIONI,'0') AVG_ACQUISIZIONI,NVL(B.PERCENTUALE_INCREMENTO,'0')
PERCENTUALE_INCREMENTO, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER )
QTA_SUPE_SOGL ,NVL(C.TOTAL_SOSPENSIONI,'0') TOTAL_SOSPENSIONI,NVL(C.SOSPENSIONI_CONFRONTO,'0')
SOSPENSIONI_CONFRONTO, NVL(D.AVG_SOSPENSIONI,'0') AVG_SOSPENSIONI,NVL(D.PERCENTUALE_INCREMENTO_SOSP,'0')
PERCENTUALE_INCREMENTO_SOSP, CAST( NULL AS NUMBER ) QTA_SOGL_SOSP, CAST( NULL AS NUMBER )
QTA_SUPE_SOGL_SOSP ,NVL(E.PERCENTUALE_SOSPENSIONI_ACQU,'0') PERCENTUALE_SOSPENSIONI_ACQU,
NVL(PERC_SOSP_ACQU_CONF,'0') PERC_SOSP_ACQU_CONF,NVL(PERCENTUALE_SUPERAMENTO,'0') PERCENTUALE_SUPERAMENTO FROM
(SELECT ROWNUM AS ID, x.* FROM (SELECT COD_DEALER, COD_PDV, TOTAL_ACQUISIZIONI, CONFRONTO_ACQUISIZIONI, CAST( NULL
AS NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL, D_RAG_SOC, D_IND, D_LOCALITA, D_CAP, D_PROVINCIA,
D_PIVA, INDIRIZZO V_IND, LOCALITA V_LOCALITA, CAP V_CAP, PROVINCIA V_PROVINCIA FROM ANAGRAFICA_DEALER, (SELECT
COD_DEALER, COD_PDV, TOTAL_ACQUISIZIONI, CONFRONTO_ACQUISIZIONI, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS
NUMBER ) QTA_SUPE_SOGL, RAGSOC D_RAG_SOC, INDIRIZZO D_IND, LOCALITA D_LOCALITA, CAP D_CAP, PROVINCIA D_PROVINCIA,
PIVA D_PIVA FROM ANAGRAFICA_DEALER, ( SELECT
A.COD_DEALER,A.COD_PDV,A.TOTAL_ACQUISIZIONI,NVL(B.TOTAL_ACQUISIZIONI,'0') CONFRONTO_ACQUISIZIONI, CAST( NULL AS
NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL FROM (SELECT A.COD_DEALER,A.COD_PDV,COUNT(A.COD_DEALER)
TOTAL_ACQUISIZIONI, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL FROM CFMS_ATT A WHERE
A.DATA_ATTIVAZIONE between TO_DATE('2015-06-15 00:00:00','yyyy-mm-dd HH24:MI:SS') AND TO_DATE('2015-06-15
23:59:59','yyyy-mm-dd HH24:MI:SS')
AND A.COD_PDV IS NOT NULL GROUP BY A.COD_DEALER,A.COD_PDV) A LEFT JOIN ( SELECT
COD_DEALER,COD_PDV,COUNT(COD_DEALER) TOTAL_ACQUISIZIONI FROM CFMS_ATT WHERE DATA_ATTIVAZIONE between
TO_DATE('2015-06-16 00:00:00','yyyy-mm-dd HH24:MI:SS') AND TO_DATE('2015-06-16 23:59:59','yyyy-mm-dd HH24:MI:SS')
AND COD_PDV IS NOT NULL GROUP BY COD_DEALER,COD_PDV ) B ON A.COD_DEALER=B.COD_DEALER AND A.COD_PDV=B.COD_PDV) WHERE
COD_DEALER = COD_ID (+)) WHERE COD_PDV = COD_ID (+) ORDER BY COD_DEALER) x ) A FULL OUTER JOIN (SELECT ROWNUM AS
ID, x.* FROM (SELECT COD_DEALER, COD_PDV, ACQUISIZIONI, AVG_ACQUISIZIONI, ACQUISIZIONI_CONFRONTO,
AVG_ACQUISIZIONI_CONFRONTO, PERCENTUALE_INCREMENTO, D_RAG_SOC, D_IND, D_LOCALITA, D_CAP, D_PROVINCIA, D_PIVA,
INDIRIZZO V_IND, LOCALITA V_LOCALITA, CAP V_CAP, PROVINCIA V_PROVINCIA FROM ANAGRAFICA_DEALER, (SELECT COD_DEALER,
COD_PDV, ACQUISIZIONI, AVG_ACQUISIZIONI, ACQUISIZIONI_CONFRONTO, AVG_ACQUISIZIONI_CONFRONTO, PERCENTUALE_INCREMENTO,
RAGSOC D_RAG_SOC, INDIRIZZO D_IND, LOCALITA D_LOCALITA, CAP D_CAP, PROVINCIA D_PROVINCIA, PIVA D_PIVA FROM
ANAGRAFICA_DEALER, ( SELECT A.COD_DEALER,A.COD_PDV,A.ACQUISIZIONI,TO_CHAR(A.AVG_ACQUISIZIONI,'99990D99')
R E A L U S E C A S E - # 2 R E P O R T I N G
AS AN analyst
I WANT TO request for a new monthly report
R E A L U S E C A S E - # 2 R E P O R T I N G
AS AN analyst
I WANT TO request for a new monthly report
SO THAT the system will send me an email
with the attached csv report
R U N I N B A C K G R O U N D
S C A L I N G T H E A S Y N C
Y O U R A P P
I S
H E R E
W O R K E R
W O R K E R
W O R K E R
W O R K E R
Q U E U E
POST /rss
PATCH /users
POST /export
A S Y N C H R O N O U S TA S K
ā€¢ https://github.com/uecode/qpush-bundle
ā€¢ https://github.com/videlalvaro/php-amqplib
ā€¢ https://github.com/videlalvaro/RabbitMqBundle
ā€¢ http://gearmanbundle.readthedocs.org/en/latest/configuration.html
ā€¢ https://github.com/chrisboulton/php-resque
T H A N K S
šŸ»time

More Related Content

What's hot

Introduction to Prometheus
Introduction to PrometheusIntroduction to Prometheus
Introduction to PrometheusJulien Pivotto
Ā 
Microservice intro
Microservice introMicroservice intro
Microservice introramesh_sharma
Ā 
Container Orchestration using Kubernetes
Container Orchestration using KubernetesContainer Orchestration using Kubernetes
Container Orchestration using KubernetesHesham Amin
Ā 
Explore your prometheus data in grafana - Promcon 2018
Explore your prometheus data in grafana - Promcon 2018Explore your prometheus data in grafana - Promcon 2018
Explore your prometheus data in grafana - Promcon 2018Grafana Labs
Ā 
Prometheus ā€“ a next-gen Monitoring System
Prometheus ā€“ a next-gen Monitoring SystemPrometheus ā€“ a next-gen Monitoring System
Prometheus ā€“ a next-gen Monitoring SystemFabian Reinartz
Ā 
SRE Conference 2022 - How to Build a Healthy On-Call Culture
SRE Conference 2022 - How to Build a Healthy On-Call CultureSRE Conference 2022 - How to Build a Healthy On-Call Culture
SRE Conference 2022 - How to Build a Healthy On-Call Culturesmalltown
Ā 
Building an Observability platform with ClickHouse
Building an Observability platform with ClickHouseBuilding an Observability platform with ClickHouse
Building an Observability platform with ClickHouseAltinity Ltd
Ā 
Prometheus
PrometheusPrometheus
Prometheuswyukawa
Ā 
Monitoring With Prometheus
Monitoring With PrometheusMonitoring With Prometheus
Monitoring With PrometheusKnoldus Inc.
Ā 
promgen - prometheus managemnet tool / simpleclient_java hacks @ Prometheus c...
promgen - prometheus managemnet tool / simpleclient_java hacks @ Prometheus c...promgen - prometheus managemnet tool / simpleclient_java hacks @ Prometheus c...
promgen - prometheus managemnet tool / simpleclient_java hacks @ Prometheus c...Tokuhiro Matsuno
Ā 
Learn O11y from Grafana ecosystem.
Learn O11y from Grafana ecosystem.Learn O11y from Grafana ecosystem.
Learn O11y from Grafana ecosystem.HungWei Chiu
Ā 
Kubernetes Summit 2023: Head First Kubernetes
Kubernetes Summit 2023: Head First Kubernetes Kubernetes Summit 2023: Head First Kubernetes
Kubernetes Summit 2023: Head First Kubernetes smalltown
Ā 
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation SlidesKubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation SlidesSlideTeam
Ā 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub ActionsKnoldus Inc.
Ā 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetesRishabh Indoria
Ā 
Docker Basics
Docker BasicsDocker Basics
Docker BasicsDuckDuckGo
Ā 
Hashicorp Corporate Pitch Deck Stenio_v2
Hashicorp Corporate Pitch Deck Stenio_v2 Hashicorp Corporate Pitch Deck Stenio_v2
Hashicorp Corporate Pitch Deck Stenio_v2 Stenio Ferreira
Ā 
Prometheus Overview
Prometheus OverviewPrometheus Overview
Prometheus OverviewBrian Brazil
Ā 

What's hot (20)

Introduction to Prometheus
Introduction to PrometheusIntroduction to Prometheus
Introduction to Prometheus
Ā 
Microservice intro
Microservice introMicroservice intro
Microservice intro
Ā 
Quarkus k8s
Quarkus   k8sQuarkus   k8s
Quarkus k8s
Ā 
Container Orchestration using Kubernetes
Container Orchestration using KubernetesContainer Orchestration using Kubernetes
Container Orchestration using Kubernetes
Ā 
Explore your prometheus data in grafana - Promcon 2018
Explore your prometheus data in grafana - Promcon 2018Explore your prometheus data in grafana - Promcon 2018
Explore your prometheus data in grafana - Promcon 2018
Ā 
Prometheus ā€“ a next-gen Monitoring System
Prometheus ā€“ a next-gen Monitoring SystemPrometheus ā€“ a next-gen Monitoring System
Prometheus ā€“ a next-gen Monitoring System
Ā 
SRE Conference 2022 - How to Build a Healthy On-Call Culture
SRE Conference 2022 - How to Build a Healthy On-Call CultureSRE Conference 2022 - How to Build a Healthy On-Call Culture
SRE Conference 2022 - How to Build a Healthy On-Call Culture
Ā 
Building an Observability platform with ClickHouse
Building an Observability platform with ClickHouseBuilding an Observability platform with ClickHouse
Building an Observability platform with ClickHouse
Ā 
Prometheus
PrometheusPrometheus
Prometheus
Ā 
Monitoring With Prometheus
Monitoring With PrometheusMonitoring With Prometheus
Monitoring With Prometheus
Ā 
promgen - prometheus managemnet tool / simpleclient_java hacks @ Prometheus c...
promgen - prometheus managemnet tool / simpleclient_java hacks @ Prometheus c...promgen - prometheus managemnet tool / simpleclient_java hacks @ Prometheus c...
promgen - prometheus managemnet tool / simpleclient_java hacks @ Prometheus c...
Ā 
Learn O11y from Grafana ecosystem.
Learn O11y from Grafana ecosystem.Learn O11y from Grafana ecosystem.
Learn O11y from Grafana ecosystem.
Ā 
Kubernetes Summit 2023: Head First Kubernetes
Kubernetes Summit 2023: Head First Kubernetes Kubernetes Summit 2023: Head First Kubernetes
Kubernetes Summit 2023: Head First Kubernetes
Ā 
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation SlidesKubernetes Concepts And Architecture Powerpoint Presentation Slides
Kubernetes Concepts And Architecture Powerpoint Presentation Slides
Ā 
Introduction to GitHub Actions
Introduction to GitHub ActionsIntroduction to GitHub Actions
Introduction to GitHub Actions
Ā 
Introduction to kubernetes
Introduction to kubernetesIntroduction to kubernetes
Introduction to kubernetes
Ā 
Docker Basics
Docker BasicsDocker Basics
Docker Basics
Ā 
Hashicorp Corporate Pitch Deck Stenio_v2
Hashicorp Corporate Pitch Deck Stenio_v2 Hashicorp Corporate Pitch Deck Stenio_v2
Hashicorp Corporate Pitch Deck Stenio_v2
Ā 
Apache Giraph: Large-scale graph processing done better
Apache Giraph: Large-scale graph processing done betterApache Giraph: Large-scale graph processing done better
Apache Giraph: Large-scale graph processing done better
Ā 
Prometheus Overview
Prometheus OverviewPrometheus Overview
Prometheus Overview
Ā 

Similar to Fast api

Meteor - not just for rockstars
Meteor - not just for rockstarsMeteor - not just for rockstars
Meteor - not just for rockstarsStephan Hochhaus
Ā 
Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016 Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016 DISID
Ā 
Asynchronous data processing
Asynchronous data processingAsynchronous data processing
Asynchronous data processingAndrea Giuliano
Ā 
į„į…©į†·į„į…¢į†ŗ #05+a-į„‡į…¢į„Žį…µ-parallel deployment
į„į…©į†·į„į…¢į†ŗ #05+a-į„‡į…¢į„Žį…µ-parallel deploymentį„į…©į†·į„į…¢į†ŗ #05+a-į„‡į…¢į„Žį…µ-parallel deployment
į„į…©į†·į„į…¢į†ŗ #05+a-į„‡į…¢į„Žį…µ-parallel deploymentGyuSeok Lee
Ā 
2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metricsBuddy Brewer
Ā 
Designing a Horizontally Scalable Event-Driven Big Data Architecture with Apa...
Designing a Horizontally Scalable Event-Driven Big Data Architecture with Apa...Designing a Horizontally Scalable Event-Driven Big Data Architecture with Apa...
Designing a Horizontally Scalable Event-Driven Big Data Architecture with Apa...Ricardo Fanjul FandiƱo
Ā 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!Blanca Mancilla
Ā 
GraphQL, l'avenir du REST ?
GraphQL, l'avenir du REST ?GraphQL, l'avenir du REST ?
GraphQL, l'avenir du REST ?Francois Zaninotto
Ā 
WordPress in 30 minutes
WordPress in 30 minutesWordPress in 30 minutes
WordPress in 30 minutesOwen Winkler
Ā 
An Introduction to CSS Preprocessors
An Introduction to CSS PreprocessorsAn Introduction to CSS Preprocessors
An Introduction to CSS PreprocessorsMiloÅ” Sutanovac
Ā 
AWS SEMINAR SERIES 2015 Perth
AWS SEMINAR SERIES 2015 PerthAWS SEMINAR SERIES 2015 Perth
AWS SEMINAR SERIES 2015 PerthAmazon Web Services
Ā 
rpm-building-101.pdf
rpm-building-101.pdfrpm-building-101.pdf
rpm-building-101.pdfstroganovboris
Ā 
AWS SeMINAR SERIES 2015 Sydney
AWS SeMINAR SERIES 2015 SydneyAWS SeMINAR SERIES 2015 Sydney
AWS SeMINAR SERIES 2015 SydneyAmazon Web Services
Ā 
AWS Seminar Series 2015 Melbourne
AWS Seminar Series 2015 MelbourneAWS Seminar Series 2015 Melbourne
AWS Seminar Series 2015 MelbourneAmazon Web Services
Ā 
Auckland AWS Seminar Series
Auckland AWS Seminar SeriesAuckland AWS Seminar Series
Auckland AWS Seminar SeriesAmazon Web Services
Ā 
AWS Seminar Series 2015 Brisbane
AWS Seminar Series 2015 BrisbaneAWS Seminar Series 2015 Brisbane
AWS Seminar Series 2015 BrisbaneAmazon Web Services
Ā 
Representing Material Culture Online: Historic Clothing in Omeka
Representing Material Culture Online: Historic Clothing in OmekaRepresenting Material Culture Online: Historic Clothing in Omeka
Representing Material Culture Online: Historic Clothing in OmekaArden Kirkland
Ā 
Microservices With Spring Boot and Spring Cloud Netflix
Microservices With Spring Boot and Spring Cloud NetflixMicroservices With Spring Boot and Spring Cloud Netflix
Microservices With Spring Boot and Spring Cloud NetflixKrzysztof Sobkowiak
Ā 

Similar to Fast api (20)

Meteor - not just for rockstars
Meteor - not just for rockstarsMeteor - not just for rockstars
Meteor - not just for rockstars
Ā 
Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016 Spring Roo 2.0 Preview at Spring I/O 2016
Spring Roo 2.0 Preview at Spring I/O 2016
Ā 
Meteor WWNRW Intro
Meteor WWNRW IntroMeteor WWNRW Intro
Meteor WWNRW Intro
Ā 
Asynchronous data processing
Asynchronous data processingAsynchronous data processing
Asynchronous data processing
Ā 
į„į…©į†·į„į…¢į†ŗ #05+a-į„‡į…¢į„Žį…µ-parallel deployment
į„į…©į†·į„į…¢į†ŗ #05+a-į„‡į…¢į„Žį…µ-parallel deploymentį„į…©į†·į„į…¢į†ŗ #05+a-į„‡į…¢į„Žį…µ-parallel deployment
į„į…©į†·į„į…¢į†ŗ #05+a-į„‡į…¢į„Žį…µ-parallel deployment
Ā 
2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics2014 06-23 velocity sc beyond page metrics
2014 06-23 velocity sc beyond page metrics
Ā 
Designing a Horizontally Scalable Event-Driven Big Data Architecture with Apa...
Designing a Horizontally Scalable Event-Driven Big Data Architecture with Apa...Designing a Horizontally Scalable Event-Driven Big Data Architecture with Apa...
Designing a Horizontally Scalable Event-Driven Big Data Architecture with Apa...
Ā 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
Ā 
GraphQL, l'avenir du REST ?
GraphQL, l'avenir du REST ?GraphQL, l'avenir du REST ?
GraphQL, l'avenir du REST ?
Ā 
WordPress in 30 minutes
WordPress in 30 minutesWordPress in 30 minutes
WordPress in 30 minutes
Ā 
An Introduction to CSS Preprocessors
An Introduction to CSS PreprocessorsAn Introduction to CSS Preprocessors
An Introduction to CSS Preprocessors
Ā 
AWS SEMINAR SERIES 2015 Perth
AWS SEMINAR SERIES 2015 PerthAWS SEMINAR SERIES 2015 Perth
AWS SEMINAR SERIES 2015 Perth
Ā 
rpm-building-101.pdf
rpm-building-101.pdfrpm-building-101.pdf
rpm-building-101.pdf
Ā 
AWS SeMINAR SERIES 2015 Sydney
AWS SeMINAR SERIES 2015 SydneyAWS SeMINAR SERIES 2015 Sydney
AWS SeMINAR SERIES 2015 Sydney
Ā 
AWS Seminar Series 2015 Melbourne
AWS Seminar Series 2015 MelbourneAWS Seminar Series 2015 Melbourne
AWS Seminar Series 2015 Melbourne
Ā 
Auckland AWS Seminar Series
Auckland AWS Seminar SeriesAuckland AWS Seminar Series
Auckland AWS Seminar Series
Ā 
AWS Seminar Series 2015 Brisbane
AWS Seminar Series 2015 BrisbaneAWS Seminar Series 2015 Brisbane
AWS Seminar Series 2015 Brisbane
Ā 
Representing Material Culture Online: Historic Clothing in Omeka
Representing Material Culture Online: Historic Clothing in OmekaRepresenting Material Culture Online: Historic Clothing in Omeka
Representing Material Culture Online: Historic Clothing in Omeka
Ā 
Microservices With Spring Boot and Spring Cloud Netflix
Microservices With Spring Boot and Spring Cloud NetflixMicroservices With Spring Boot and Spring Cloud Netflix
Microservices With Spring Boot and Spring Cloud Netflix
Ā 
eHarmony @ Phoenix Con 2016
eHarmony @ Phoenix Con 2016eHarmony @ Phoenix Con 2016
eHarmony @ Phoenix Con 2016
Ā 

More from Simone Di Maulo

The dark side of the app
The dark side of the appThe dark side of the app
The dark side of the appSimone Di Maulo
Ā 
On fuctional programming, high order functions, ML
On fuctional programming, high order functions, MLOn fuctional programming, high order functions, ML
On fuctional programming, high order functions, MLSimone Di Maulo
Ā 
Processing asyncrono dei dati - Symfony2 ā¤ Message Queuing
Processing asyncrono dei dati - Symfony2 ā¤ Message QueuingProcessing asyncrono dei dati - Symfony2 ā¤ Message Queuing
Processing asyncrono dei dati - Symfony2 ā¤ Message QueuingSimone Di Maulo
Ā 

More from Simone Di Maulo (6)

Orm hero
Orm heroOrm hero
Orm hero
Ā 
PHP Generators
PHP GeneratorsPHP Generators
PHP Generators
Ā 
Docker cqrs react
Docker cqrs reactDocker cqrs react
Docker cqrs react
Ā 
The dark side of the app
The dark side of the appThe dark side of the app
The dark side of the app
Ā 
On fuctional programming, high order functions, ML
On fuctional programming, high order functions, MLOn fuctional programming, high order functions, ML
On fuctional programming, high order functions, ML
Ā 
Processing asyncrono dei dati - Symfony2 ā¤ Message Queuing
Processing asyncrono dei dati - Symfony2 ā¤ Message QueuingProcessing asyncrono dei dati - Symfony2 ā¤ Message Queuing
Processing asyncrono dei dati - Symfony2 ā¤ Message Queuing
Ā 

Recently uploaded

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
Ā 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
Ā 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
Ā 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
Ā 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
Ā 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
Ā 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
Ā 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
Ā 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
Ā 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
Ā 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
Ā 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
Ā 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
Ā 
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024BookNet Canada
Ā 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜RTylerCroy
Ā 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
Ā 
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhisoniya singh
Ā 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
Ā 

Recently uploaded (20)

The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
Ā 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
Ā 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Ā 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
Ā 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
Ā 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Ā 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
Ā 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
Ā 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
Ā 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Ā 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
Ā 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
Ā 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
Ā 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
Ā 
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: Whatā€™s new for BISAC - Tech Forum 2024
Ā 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Ā 
šŸ¬ The future of MySQL is Postgres šŸ˜
šŸ¬  The future of MySQL is Postgres   šŸ˜šŸ¬  The future of MySQL is Postgres   šŸ˜
šŸ¬ The future of MySQL is Postgres šŸ˜
Ā 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
Ā 
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | DelhiFULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY šŸ” 8264348440 šŸ” Call Girls in Diplomatic Enclave | Delhi
Ā 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
Ā 

Fast api

  • 1. FA S T P H P A P I
  • 2. W H O A M I Simone Di Maulo - aka @toretto460 PUGGER http://toretto.me
  • 3. A G E N D A
  • 4. A G E N D A ā€¢ Performance
  • 5. A G E N D A ā€¢ Performance ā€¢ HTTP
  • 6. A G E N D A ā€¢ Performance ā€¢ HTTP ā€¢ DB Performance
  • 7. A G E N D A ā€¢ Performance ā€¢ HTTP ā€¢ DB Performance ā€¢ Heavy load tasks
  • 8. A G E N D A ā€¢ Performance ā€¢ HTTP ā€¢ DB Performance ā€¢ Heavy load tasks
  • 9. R E S P O N S E T I M E X m s
  • 10. ā€” D O N A L D K N U T H ā€” ā€œ S T R U C T U R E D P R O G R A M M I N G W I T H G O T O S TAT E M E N T S ā€ [ā€¦] premature optimization is the root of all evil.
  • 11. ā€” D O N A L D K N U T H ā€” ā€œ S T R U C T U R E D P R O G R A M M I N G W I T H G O T O S TAT E M E N T S ā€ [ā€¦] premature optimization is the root of all evil. K E E P I N M I N D
  • 12. M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E M E A S U R E
  • 13. L O A D T E S T S
  • 14.
  • 15.
  • 16. A PA C H E B E N C H M A R K ab -n 200 -c 50 -k -g bench.tsv http://my.api.test/v1/pro... ^[1] ^[2] ^[3] ^[4] ^[5] 1. Number of requests 2. Concurrent requests 3. Use the keep-alive connection 4. Write the output ready for gnuplot 5. The URL to call
  • 17. A PA C H E B E N C H M A R K ## Graph configuration ## # Set the output format and size set terminal jpeg size 1280,800 # Set the aspect ratio set size 1, 1 # Title set title "Benchmark testing" # The legend/key position set key left top # Draw gridlines on the y axis set grid y # Label the x-axis set xlabel 'seconds' # Label the y-axis set ylabel "response time (ms)" ## I/O Configuration # Specify that the x-series data is time data set xdata time # The output file set output "bench.jpg" # Specify the *input* format of the time data set timefmt "%s" # Specify the *output* format for the x labels set format x "%S" # Use tabs as the delimiter instead of spaces set datafile separator 't' ## Run the Plot # Plot the data plot "bench.tsv" every ::2 using 2:5 with points exit
  • 19. ā€¢ https://blackfire.io ā€¢ https://tideways.io ā€¢ http://xhprof.io/ ā€¢ https://symfony.com/doc/current/cookbook/profiler/ index.html
  • 20. A G E N D A ā€¢ Performance ā€¢ HTTP ā€¢ DB Performance ā€¢ Heavy load tasks
  • 21. HTTP is a ā€œcontractā€
  • 22. H T T P I S Y O U R F R I E N D
  • 25. COMPRESSION ā¤ SLOW MOBILE NETWORKS
  • 26. C A C H I N G
  • 27. $ curl -I http://my-api.com/users/toretto460
  • 28. $ curl -I http://my-api.com/users/toretto460 { ā€œidā€: da34gtyu50-lo983, ā€œusernameā€: ā€œtoretto460ā€, . . . }
  • 29. $ curl -I http://my-api.com/users/toretto460 { ā€œidā€: da34gtyu50-lo983, ā€œusernameā€: ā€œtoretto460ā€, . . . } HTTP/1.1 200 OK Connection: keep-alive Content-Type: application/json; charset=utf-8 Date: Sat, 28 Jul 2015 20:12:45 GMT Cache-Control: private max-age=600 ETag: 88493f3-4afd-507dd8e0aa030
  • 30. { ā€œidā€: da34gtyu50-lo983, ā€œusernameā€: ā€œtoretto460ā€, . . . } $ curl -I http://my-api.com/users/toretto460 HTTP/1.1 200 OK Connection: keep-alive Content-Type: application/json; charset=utf-8 Date: Sat, 28 Jul 2015 20:12:45 GMT Cache-Control: private max-age=600 ETag: 88493f3-4afd-507dd8e0aa030
  • 31. { ā€œidā€: da34gtyu50-lo983, ā€œusernameā€: ā€œtoretto460ā€, . . . } $ curl -I http://my-api.com/users/toretto460 HTTP/1.1 200 OK Connection: keep-alive Content-Type: application/json; charset=utf-8 Date: Sat, 28 Jul 2015 20:12:45 GMT Cache-Control: private max-age=600 ETag: 88493f3-4afd-507dd8e0aa030
  • 32. { ā€œidā€: da34gtyu50-lo983, ā€œusernameā€: ā€œtoretto460ā€, . . . } $ curl -I http://my-api.com/users/toretto460 HTTP/1.1 200 OK Connection: keep-alive Content-Type: application/json; charset=utf-8 Date: Sat, 28 Jul 2015 20:12:45 GMT Cache-Control: private max-age=600 ETag: 88493f3-4afd-507dd8e0aa030
  • 33. { ā€œidā€: da34gtyu50-lo983, ā€œusernameā€: ā€œtoretto460ā€, . . . } $ curl -I http://my-api.com/users/toretto460 HTTP/1.1 200 OK Connection: keep-alive Content-Type: application/json; charset=utf-8 Date: Sat, 28 Jul 2015 20:12:45 GMT Cache-Control: private max-age=600 ETag: 88493f3-4afd-507dd8e0aa030 Avoid same request until 28 Jul 2015 20:22:45 GMT
  • 35. P L AY W I T H H E A D E R S public function getAction($userIdentifier, Request $request) { $response = new Response(); $user = $this->fetchUser($userIdentifier); $response->setETag($user->caclulateETag()); // $response->setLastModified($user->getLastUpdateDate()); if ($response->isNotModified($request)) { return $response; } ... } T O O M U C H M A G I C I N S I D E
  • 37. D ATA C O M P R E S S I O N
  • 38. HTTP Compression is a set of rules defined by the protocol which enable network entities (Client and Server) to exchange compressed data.
  • 39. # Apache Configuration File # ------------------------------------------------------------------------------ # | Compression | # ------------------------------------------------------------------------------ <IfModule mod_deflate.c> <IfModule mod_filter.c> AddOutputFilterByType DEFLATE application/javascript application/json text/css text/html text/plain text/xml </IfModule> </IfModule> E N A B L E C O M P R E S S I O N
  • 40. # Apache Configuration File # ------------------------------------------------------------------------------ # | Compression | # ------------------------------------------------------------------------------ <IfModule mod_deflate.c> <IfModule mod_filter.c> DeflateFilterNote Input input_info DeflateFilterNote Output output_info DeflateFilterNote Ratio ratio_info LogFormat '"%r" %{output_info}n/%{input_info}n (%{ratio_info}n%%)' deflate CustomLog /var/log/apache2/deflate_log deflate </IfModule> </IfModule> L O G C O M P R E S S I O N
  • 41. H T T P C O M P R E S S I O N GET /users/toretto460 HTTP/1.1 Host: www.example.com Accept-Encoding: gzip, deflate HTTP/1.1 200 OK Date: mon, 27 Jul 2015 22:38:34 GMT Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux) Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT Accept-Ranges: bytes Content-Length: 438 Connection: close Content-Type: text/html; charset=UTF-8 Content-Encoding: gzip
  • 42. H T T P C O M P R E S S I O N GET /users/toretto460 HTTP/1.1 Host: www.example.com HTTP/1.1 200 OK Date: mon, 27 Jul 2015 22:38:34 GMT Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux) Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT Accept-Ranges: bytes Content-Length: 438 Connection: close Content-Type: text/html; charset=UTF-8 Accept-Encoding: gzip, deflate Content-Encoding: gzip
  • 43. T H E P O W E R O F H T T P Client ServerISP Proxy
  • 44. T H E P O W E R O F H T T P Client ServerISP Proxy Client cache
  • 45. T H E P O W E R O F H T T P Client ServerISP Proxy Client cache Public cache
  • 46. T H E P O W E R O F H T T P Client ServerISP Proxy Client cache Public cache Reverse Proxy Data compression
  • 47. A G E N D A ā€¢ Performance ā€¢ HTTP ā€¢ DB Performance ā€¢ Heavy load tasks
  • 48. O R M H E R O
  • 49. T I P S ā€¢ AUTO_INCREMENT / SEQUENCE are not so cheap ā€¢ Understanding the TRACKING POLICY ā€¢ Use READONLY entities ā€¢ Letā€™s CACHE
  • 50. A U T O _ I N C R E M E N T & S E Q U E N C E S A R E N O T S O C H E A P class User { /** * @ORMId * @ORMColumn(name="ID", type="string", length=37, nullable=false) * @ORMGeneratedValue(strategy="AUTO") */ private $id; }
  • 51. A U T O _ I N C R E M E N T & S E Q U E N C E S A R E N O T S O C H E A P class User { /** * @ORMId * @ORMColumn(name="ID", type="string", length=37, nullable=false) * @ORMGeneratedValue(strategy="AUTO") */ private $id; public function __construct(UserInfoDTO $userInfo) { $this->id = (string) Uuid::uuid4(); $this->name = $userInfo->name; ... } }
  • 52. U N D E R S TA N D I N G T H E T R A C K I N G P O L I C Y
  • 53. U N D E R S TA N D I N G T H E T R A C K I N G P O L I C Y ā€” M A R T I N F O W L E R ā€” ā€œMaintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency problems.ā€ UNIT OF WORK
  • 54. U N I T O F W O R K D ATA B A S E
  • 55. $em->persist($user); U N I T O F W O R K D ATA B A S E
  • 56. $em->persist($user); U N I T O F W O R K D ATA B A S E
  • 57. $em->persist($user); U N I T O F W O R K $em->flush(); D ATA B A S E
  • 59. D E F E R R E D I M P L I C I T With this policy, Doctrine detects the changes by a property-by-property comparison at commit time and also detects changes to entities or new entities that are referenced by other managed entities ā€¦ http://doctrine-orm.readthedocs.org/en/latest/reference/change-tracking-policies.html
  • 60. D E F E R R E D I M P L I C I T http://doctrine-orm.readthedocs.org/en/latest/reference/change-tracking-policies.html class User { /** * @ORMId * @ORMColumn(name="ID", type="string", length=37, nullable=false) */ private $id; /** * @ORMColumn(name="FIRST_NAME", type="string", length=100, nullable=false) */ private $firstName; /** * @ORMColumn(name="LAST_NAME", type="string", length=100, nullable=false) */ private $lastName; /** * @ORMColumn(name="BIRTH_DATE", type="date", nullable=false) */ private $birthDate; } UOW $em->flush();
  • 61. D E F E R R E D E X P L I C I T ā€¦ the difference is that Doctrine 2 only considers entities that have been explicitly marked for change detection through a call to EntityManager::persist(entity) or through a save cascade. http://doctrine-orm.readthedocs.org/en/latest/reference/change-tracking-policies.html
  • 62. D E F E R R E D E X P L I C I T http://doctrine-orm.readthedocs.org/en/latest/reference/change-tracking-policies.html class User { /** * @ORMId * @ORMColumn(name="ID", type="string", length=37, nullable=false) */ private $id; /** * @ORMColumn(name="FIRST_NAME", type="string", length=100, nullable=false) */ private $firstName; /** * @ORMColumn(name="LAST_NAME", type="string", length=100, nullable=false) */ private $lastName; /** * @ORMColumn(name="BIRTH_DATE", type="date", nullable=false) */ private $birthDate; } UOW $em->persist($user); $em->flush();
  • 63. N O T I F Y This policy is based on the assumption that the entities notify interested listeners of changes to their properties. For that purpose, a class that wants to use this policy needs to implement the NotifyPropertyChanged interface http://doctrine-orm.readthedocs.org/en/latest/reference/change-tracking-policies.html
  • 64. N O T I F Y <?php use DoctrineCommonNotifyPropertyChanged, DoctrineCommonPropertyChangedListener; /** * @Entity * @ChangeTrackingPolicy("NOTIFY") */ class User implements NotifyPropertyChanged { // ... private $_listeners = array(); public function addPropertyChangedListener(PropertyChangedListener $listener) { $this->_listeners[] = $listener; } }
  • 65. N O T I F Y <?php // . . . protected function _onPropertyChanged($propName, $oldValue, $newValue) { if ($this->_listeners) { foreach ($this->_listeners as $listener) { $listener->propertyChanged($this, $propName, $oldValue, $newValue); } } } public function setData($data) { if ($data != $this->data) { $this->_onPropertyChanged('data', $this->data, $data); $this->data = $data; } } }
  • 66. U S E R E A D O N LY E N T I T I E S This means that the entity marked as read only is never considered for updates
  • 67. U S E R E A D O N LY E N T I T I E S /** * @ORMEntity(readOnly=true) */ class NewsTag { /** * @ORMId * @ORMColumn(name="ID", type="string", length=37, nullable=false) */ private $id; }
  • 68. L E T ā€™ S C A C H E /** * Configure the Doctrine ORM with a result cache provider. */ $config = new DoctrineORMConfiguration(); // The APC way $apcCacheDriver = new DoctrineCommonCacheApcCache(); $config->setResultCacheImpl($apcCacheDriver); // The memcache way $memcache = new Memcache(); $memcache->connect('memcache_host', 11211); $memCacheDriver = new DoctrineCommonCacheMemcacheCache(); $memCacheDriver->setMemcache($memcache); $config->setResultCacheImpl($memCacheDriver);
  • 69. L E T ā€™ S C A C H E doctrine: orm: metadata_cache_driver: apc query_cache_driver: apc result_cache_driver: type: memcache host: localhost port: 11211
  • 70. L E T ā€™ S C A C H E class UserRepository { /** * @return User[] */ protected function findLocked() { $qb = $this->createQueryBuilder('user'); $qb->where($qb->expr()->eq('user.locked', true)); $query = $qb->getQuery(); $query->useResultCache(true, 60 * 2 /* 2 minutes */); return $query->getResult(); } }
  • 71. R E A L U S E C A S E - # 1 D ATA I M P O R T > 2 0 0 K E N T I T I E S SEQUENCE UUID $em->flush(get_class($entity)); $em->clear(get_class($entity));
  • 72. R E A L U S E C A S E - # 1 D ATA I M P O R T > 2 0 0 K E N T I T I E S
  • 73. R E A L U S E C A S E - # 1 D ATA I M P O R T > 2 0 0 K E N T I T I E S 208k Entities loaded in 2h 25m šŸ˜Ÿ
  • 74. R E A L U S E C A S E - # 1 D ATA I M P O R T > 2 0 0 K E N T I T I E S
  • 75. R E A L U S E C A S E - # 1 D ATA I M P O R T > 2 0 0 K E N T I T I E S AFTER THE CURE 208k Entities loaded in 28 minutes šŸ˜Š
  • 76. A G E N D A ā€¢ Performance ā€¢ HTTP ā€¢ DB Performance ā€¢ Heavy load tasks
  • 77. S L O W TA S K The user avatar should be resized to 300x300px The administrator should upload up to 250k orders in a single cvs file Send an email when a new post has been created
  • 78. S L O W TA S K A crawler should find and aggregate product info Every X minutes the rss feed should be updated The user can export all the orders
  • 79. R E A L U S E C A S E - # 2 R E P O R T I N G
  • 80. R E A L U S E C A S E - # 2 R E P O R T I N G AS AN analyst I WANT TO request for a new monthly report
  • 81. R E A L U S E C A S E - # 2 R E P O R T I N G AS AN analyst I WANT TO request for a new monthly report CREATE TABLE TMP_CFMS_R7_7844 AS SELECT ROWNUM AS ID, x.* FROM (SELECT COD_DEALER, COD_PDV, TOTAL_ACQUISIZIONI, CONFRONTO_ACQUISIZIONI, AVG_ACQUISIZIONI, PERCENTUALE_INCREMENTO, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL, TOTAL_SOSPENSIONI, SOSPENSIONI_CONFRONTO, AVG_SOSPENSIONI, PERCENTUALE_INCREMENTO_SOSP, CAST( NULL AS NUMBER ) QTA_SOGL_SOSP, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL_SOSP, PERCENTUALE_SOSPENSIONI_ACQU, PERC_SOSP_ACQU_CONF, PERCENTUALE_SUPERAMENTO, D_RAG_SOC, D_IND, D_LOCALITA, D_CAP, D_PROVINCIA, D_PIVA, INDIRIZZO V_IND, LOCALITA V_LOCALITA, CAP V_CAP, PROVINCIA V_PROVINCIA FROM ANAGRAFICA_DEALER, (SELECT COD_DEALER, COD_PDV, TOTAL_ACQUISIZIONI, CONFRONTO_ACQUISIZIONI, AVG_ACQUISIZIONI, PERCENTUALE_INCREMENTO, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL, TOTAL_SOSPENSIONI, SOSPENSIONI_CONFRONTO, AVG_SOSPENSIONI, PERCENTUALE_INCREMENTO_SOSP, CAST( NULL AS NUMBER ) QTA_SOGL_SOSP, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL_SOSP, PERCENTUALE_SOSPENSIONI_ACQU, PERC_SOSP_ACQU_CONF, PERCENTUALE_SUPERAMENTO, RAGSOC D_RAG_SOC, INDIRIZZO D_IND, LOCALITA D_LOCALITA, CAP D_CAP, PROVINCIA D_PROVINCIA, PIVA D_PIVA FROM ANAGRAFICA_DEALER, (SELECT A.COD_DEALER,A.COD_PDV,NVL(A.TOTAL_ACQUISIZIONI,'0') TOTAL_ACQUISIZIONI,NVL(A.CONFRONTO_ACQUISIZIONI,'0') CONFRONTO_ACQUISIZIONI,NVL(B.AVG_ACQUISIZIONI,'0') AVG_ACQUISIZIONI,NVL(B.PERCENTUALE_INCREMENTO,'0') PERCENTUALE_INCREMENTO, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL ,NVL(C.TOTAL_SOSPENSIONI,'0') TOTAL_SOSPENSIONI,NVL(C.SOSPENSIONI_CONFRONTO,'0') SOSPENSIONI_CONFRONTO, NVL(D.AVG_SOSPENSIONI,'0') AVG_SOSPENSIONI,NVL(D.PERCENTUALE_INCREMENTO_SOSP,'0') PERCENTUALE_INCREMENTO_SOSP, CAST( NULL AS NUMBER ) QTA_SOGL_SOSP, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL_SOSP ,NVL(E.PERCENTUALE_SOSPENSIONI_ACQU,'0') PERCENTUALE_SOSPENSIONI_ACQU, NVL(PERC_SOSP_ACQU_CONF,'0') PERC_SOSP_ACQU_CONF,NVL(PERCENTUALE_SUPERAMENTO,'0') PERCENTUALE_SUPERAMENTO FROM (SELECT ROWNUM AS ID, x.* FROM (SELECT COD_DEALER, COD_PDV, TOTAL_ACQUISIZIONI, CONFRONTO_ACQUISIZIONI, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL, D_RAG_SOC, D_IND, D_LOCALITA, D_CAP, D_PROVINCIA, D_PIVA, INDIRIZZO V_IND, LOCALITA V_LOCALITA, CAP V_CAP, PROVINCIA V_PROVINCIA FROM ANAGRAFICA_DEALER, (SELECT COD_DEALER, COD_PDV, TOTAL_ACQUISIZIONI, CONFRONTO_ACQUISIZIONI, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL, RAGSOC D_RAG_SOC, INDIRIZZO D_IND, LOCALITA D_LOCALITA, CAP D_CAP, PROVINCIA D_PROVINCIA, PIVA D_PIVA FROM ANAGRAFICA_DEALER, ( SELECT A.COD_DEALER,A.COD_PDV,A.TOTAL_ACQUISIZIONI,NVL(B.TOTAL_ACQUISIZIONI,'0') CONFRONTO_ACQUISIZIONI, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL FROM (SELECT A.COD_DEALER,A.COD_PDV,COUNT(A.COD_DEALER) TOTAL_ACQUISIZIONI, CAST( NULL AS NUMBER ) QTA_SOGL, CAST( NULL AS NUMBER ) QTA_SUPE_SOGL FROM CFMS_ATT A WHERE A.DATA_ATTIVAZIONE between TO_DATE('2015-06-15 00:00:00','yyyy-mm-dd HH24:MI:SS') AND TO_DATE('2015-06-15 23:59:59','yyyy-mm-dd HH24:MI:SS') AND A.COD_PDV IS NOT NULL GROUP BY A.COD_DEALER,A.COD_PDV) A LEFT JOIN ( SELECT COD_DEALER,COD_PDV,COUNT(COD_DEALER) TOTAL_ACQUISIZIONI FROM CFMS_ATT WHERE DATA_ATTIVAZIONE between TO_DATE('2015-06-16 00:00:00','yyyy-mm-dd HH24:MI:SS') AND TO_DATE('2015-06-16 23:59:59','yyyy-mm-dd HH24:MI:SS') AND COD_PDV IS NOT NULL GROUP BY COD_DEALER,COD_PDV ) B ON A.COD_DEALER=B.COD_DEALER AND A.COD_PDV=B.COD_PDV) WHERE COD_DEALER = COD_ID (+)) WHERE COD_PDV = COD_ID (+) ORDER BY COD_DEALER) x ) A FULL OUTER JOIN (SELECT ROWNUM AS ID, x.* FROM (SELECT COD_DEALER, COD_PDV, ACQUISIZIONI, AVG_ACQUISIZIONI, ACQUISIZIONI_CONFRONTO, AVG_ACQUISIZIONI_CONFRONTO, PERCENTUALE_INCREMENTO, D_RAG_SOC, D_IND, D_LOCALITA, D_CAP, D_PROVINCIA, D_PIVA, INDIRIZZO V_IND, LOCALITA V_LOCALITA, CAP V_CAP, PROVINCIA V_PROVINCIA FROM ANAGRAFICA_DEALER, (SELECT COD_DEALER, COD_PDV, ACQUISIZIONI, AVG_ACQUISIZIONI, ACQUISIZIONI_CONFRONTO, AVG_ACQUISIZIONI_CONFRONTO, PERCENTUALE_INCREMENTO, RAGSOC D_RAG_SOC, INDIRIZZO D_IND, LOCALITA D_LOCALITA, CAP D_CAP, PROVINCIA D_PROVINCIA, PIVA D_PIVA FROM ANAGRAFICA_DEALER, ( SELECT A.COD_DEALER,A.COD_PDV,A.ACQUISIZIONI,TO_CHAR(A.AVG_ACQUISIZIONI,'99990D99')
  • 82. R E A L U S E C A S E - # 2 R E P O R T I N G AS AN analyst I WANT TO request for a new monthly report
  • 83. R E A L U S E C A S E - # 2 R E P O R T I N G AS AN analyst I WANT TO request for a new monthly report SO THAT the system will send me an email with the attached csv report
  • 84. R U N I N B A C K G R O U N D
  • 85. S C A L I N G T H E A S Y N C Y O U R A P P I S H E R E W O R K E R W O R K E R W O R K E R W O R K E R Q U E U E POST /rss PATCH /users POST /export
  • 86. A S Y N C H R O N O U S TA S K ā€¢ https://github.com/uecode/qpush-bundle ā€¢ https://github.com/videlalvaro/php-amqplib ā€¢ https://github.com/videlalvaro/RabbitMqBundle ā€¢ http://gearmanbundle.readthedocs.org/en/latest/configuration.html ā€¢ https://github.com/chrisboulton/php-resque
  • 87. T H A N K S