Perf-Boost (+85%) for SF/Composer Projects in Docker

Today I was working on a php development environment using docker on MacOSX (you might run into the same problems on windows, too!). The osxfs in Docker for Mac is painfully slow and the company behind docker is actually aware of that. At #77 they track the issue at docker-for-mac right now. At the time of writing the ticket is still open.

If you happen to use symfony as PHP framework or in particular composer as package manager for php projects, you end up with a very big directory called vendor.

In symfony standard edition I am counting 10259 files and folders.

For this blog post I put a vanilla symfony 3.2.7 project at DracoBlue/symfony-composer-docker-performance-test. With this commit I added a docker-compose.yml and a nginx.conf to run app.php on http://app.locahost.me:8080 and app_dev.php on http://dev.locahost.me:8080.

If you run a quick benchmark against app_dev.php:

$ ab -n 1000 -c 16 http://dev.localtest.me:8080/
Concurrency Level:      16
Time taken for tests:   319.303 seconds
Complete requests:      1000
Failed requests:        0
Requests per second:    3.13 [#/sec] (mean)
Time per request:       5108.845 [ms] (mean)
Time per request:       319.303 [ms] (mean, across all concurrent requests)
Transfer rate:          131.33 [Kbytes/sec] received

you end up with response times for a vanilla symfony project of round about 319ms.

The app.php:

$ ab -n 1000 -c 16 http://app.localtest.me:8080/
Concurrency Level:      16
Time taken for tests:   86.140 seconds
Complete requests:      1000
Failed requests:        0
Requests per second:    11.61 [#/sec] (mean)
Time per request:       1378.234 [ms] (mean)
Time per request:       86.140 [ms] (mean, across all concurrent requests)
Transfer rate:          54.50 [Kbytes/sec] received

looks better (86ms), but is not very convenient for development.

Let's tune this with a simple trick down to 46ms (-85%) for app_dev.php and down to 9ms (-88%) for app.php.

Continue reading ...

In docker, docker-compose, lsyncd, open source, symfony by DracoBlue @ 07 Apr 2017 | 1406 Words

Hanging subrequests in Nginx

While I was working on lua-native-ssi-nginx (an opinionated lua replacement of nginx's ssi directive), I ran into the following issue:

The proxy_pass requests seemed to hang (or lock) as soon as the response was too big.

Even with nginx in debug mode, I could only see this in the error.log:

2016/10/08 10:47:19 [debug] 31895#0: *1337 http upstream request: "/sub-request?"
2016/10/08 10:47:19 [debug] 31895#0: *1337 http upstream dummy handler
2016/10/08 10:47:19 [debug] 31895#0: *1337 http upstream request: "/sub-request?"
2016/10/08 10:47:19 [debug] 31895#0: *1337 http upstream dummy handler
2016/10/08 10:47:19 [debug] 31895#0: *1337 http upstream request: "/sub-request?"
Continue reading ...

In lua, nginx, open source by DracoBlue @ 09 Oct 2016 | 241 Words

Review: Building Microservices

TL;DR: Recommended?
Awesome! ⭐️⭐️⭐️⭐️⭐️
Buy at Amazon:

When Sam Newman's book (280 pages) on microservices was released in the first month of january 2015, I was already reading a preview edition for some weeks. Having the book as paper version next to my desk, let's me open it once in a while to find a good example for a concept or a piece of software for my microservices day work.

The book is not about indepth knowledge about every part of hosting lots of little connected systems, but gives such an awesome overview about all parts, that I can encourage everybody maintaining or creating systems and libraries to read this book!

Continue reading ...

In consul, java, microservices, nodejs, read, soa, spring-boot by DracoBlue @ 10 Jun 2016 | 547 Words

Review: Spring Data JPA Reference

TL;DR: Recommended?
Really good read! ⭐️⭐️⭐️⭐️⭐️️
Read Online as:

After reading the spring boot reference in november, I wanted to know more in depth knowledge of spring data. That's why I read the official spring data jpa reference.

Something new to me is, that you can use _ in spring data repository interface names to give a hint to the query builder. So:

List<Person> findByAddress_ZipCode(ZipCode zipCode);
// resolves to address.zipCode or address.zip.code
Continue reading ...

In java, read, spring, spring-boot, spring-data by DracoBlue @ 31 Mar 2016 | 243 Words

Fix DOM Exception 5 invalid character with atob

When I was developing on http://web.twtxt.org I ran into this mysterious javascript error:

InvalidCharacterError: DOM Exception 5: An invalid or illegal character was specified, such as in an XML name.
(anonyme Funktion)bundle.js:245

The source code in question took a base64 encoded content of the github api and converted it with window.atob into an utf8 string.

This worked well except for safari on iOS!

Continue reading ...

In ios, javascript, safari by DracoBlue @ 21 Mar 2016 | 220 Words

Page 1 - Page 2

Recent Files


Recent Dev-Articles

Read recently