フィードアグリゲーター

Voices of the ElePHPant: Interview with Matthias Noback

phpdeveloper.org - 2019-05-02(木) 03:00:02

@matthiasnoback

Show Notes Style Guide for Object Design: Release of the PHP edition Mattias’ Blog

Audio

This episode is sponsored by

The post Interview with Matthias Noback appeared first on Voices of the ElePHPant.

カテゴリー: php

murze.be: ★ Video: getting started with event sourcing in Laravel

phpdeveloper.org - 2019-05-02(木) 02:30:02

The last few months I gave a talk on how to get started with event sourcing at several conferences and user groups. I took the time to record the talk at home. It's now published on YouTube so everybody can enjoy it. The video below is targeted at newcomers to event sourcing. We'll first explain a ...

カテゴリー: php

Blog entries :: phly, boy, phly: Managing Multiple PHP versions via the ondrej/php PPA

phpdeveloper.org - 2019-05-02(木) 02:30:02

Last week, I did some system updates, and then decided to compile the most recent PHP releases. I've used phpbrew to manage multiple PHP releases for a number of years, and having it install a new version is fairly routine. Except this time, it wasn't. Due to updates I installed, I was getting e...

カテゴリー: php

Laravel News: Testing Streamed Responses in Laravel

phpdeveloper.org - 2019-05-02(木) 02:30:02
Let’s look at how Laravel helps us write controllers that force a user download without creating a file on the server and how to write tests for streamed downloads. Visit Laravel News for the full post. The post Testing Strea...
カテゴリー: php

Ibrar Ahmed: Benchmark ClickHouse Database and clickhousedb_fdw

planet postgresql - 2019-05-02(木) 01:37:29

In this research,  I wanted to see what kind of performance improvements could be gained by using a ClickHouse data source rather than PostgreSQL. Assuming that I would see performance advantages with using ClickHouse, would those advantages be retained if I access ClickHouse from within postgres using a foreign data wrapper (FDW)? The FDW in question is clickhousedb_fdw – an open source project from Percona!

The database environments under scrutiny are PostgreSQL v11, clickhousedb_fdw and a ClickHouse database. Ultimately, from within PostgreSQL v11, we are going to issue various SQL queries routed through our clickhousedb_fdw to the ClickHouse database. Then we’ll see how the FDW performance compares with those same queries executed in native PostgreSQL and native ClickHouse.

Clickhouse Database

ClickHouse is an open source column based database management system which can achieve performance of between 100 and 1000 times faster than traditional database approaches, capable of processing more than a billion rows in less than a second.

Clickhousedb_fdw

clickhousedb_fdw, a ClickHouse database foreign data wrapper, or FDW, is an open source project from Percona. Here’s a link for the GitHub project repository:

https://github.com/Percona-Lab/clickhousedb_fdw

I wrote a blog in March which tells you more about our FDW: https://www.percona.com/blog/2019/03/29/postgresql-access-clickhouse-one-of-the-fastest-column-dbmss-with-clickhousedb_fdw/

As you’ll see, this provides for an FDW for ClickHouse that allows you to SELECT from, and INSERT INTO, a ClickHouse database from within a PostgreSQL v11 server.

The FDW supports advanced features such as aggregate pushdown and joins pushdown. These significantly improve performance by utilizing the remote server’s resources for these resource intensive operations.

Benchmark environment
  • Supermicro server:
    • Intel(R) Xeon(R) CPU E5-2683 v3 @ 2.00GHz
    • 2 sockets / 28 cores / 56 threads
    • Memory: 256GB of RAM
    • Storage: Samsung  SM863 1.9TB Enterprise SSD
    • Filesystem: ext4/xfs
  • OS: Linux
[...]
カテゴリー: postgresql

Hubert 'depesz' Lubaczewski: Waiting for PostgreSQL 12 – Allow VACUUM to be run with index cleanup disabled.

planet postgresql - 2019-05-01(水) 10:02:06
On 4th of April 2019, Robert Haas committed patch: Allow VACUUM to be run with index cleanup disabled.     This commit adds a new reloption, vacuum_index_cleanup, which controls whether index cleanup is performed for a particular relation by default. It also adds a new option to the VACUUM command, INDEX_CLEANUP, which can be used … Continue reading "Waiting for PostgreSQL 12 – Allow VACUUM to be run with index cleanup disabled."
カテゴリー: postgresql

Managing Multiple PHP versions via the ondrej/php PPA

planet PHP - 2019-05-01(水) 07:10:00

Last week, I did some system updates, and then decided to compile the most recent PHP releases. I've used phpbrew to manage multiple PHP releases for a number of years, and having it install a new version is fairly routine.

Except this time, it wasn't. Due to updates I installed, I was getting errors first with compiling the GD extension, then with ext-intl:

  • If you want Freetype support in ext-gd, you are expected to install the package libfreetype-dev. On Ubuntu, this now installs libfreetype6-dev, which no longer includes the freetype-config binary that PHP's configure script uses to determine what features it supports.

  • Similarly, ext-intl depends on the package libicu-dev. Ubuntu's package now omits the icu-config binary used by PHP to determine feature support.

I searched for quite some time to find packages that would resolve these problems. I could have found the source code and compiled it and linked to that, but that would mean keeping that up-to-date on top of my PHP installs.

I even looked in the ondrej/php PPA, as that repository has multiple PHP versions already, including source packages.

And then I thought: why not try using those instead of phpbrew?

The rest of this post is how I made that work.

I use Ubuntu for my operating system. The instructions I present here should work on any Debian-based system, but your mileage may vary. If you are using an RPM-based system, yum will be your friend, but I have no idea how to add repositories in that system, nor if update-alternatives is available. As such, these instructions may or may not help you.

Which is okay. I mainly wrote them to help future me.

Register the PPA

First, I had to add the PPA to the system:

$ sudo add-apt-repository ppa:ondrej/ppa

Then the usual:

$ sudo apt update Approach to installation

I first identified the extensions I typically install, matched them to packages in the PPA, and made a list. I knew I'd be installing the same extensions across all PHP versions I wanted, so I figured I could script it a bit.

From there, I executed the following from the CLI:

$ for VERSION in 5.6 7.0 7.1 7.2 7.3;do for> for EXTENSION in {listed all extensions here};do for for> sudo apt install php${VERSION}-${EXTENSION} for for> done for> done

This grabbed and installed each PHP I needed along with all extensions I wanted.

Switching between versions

To switch between versions, you have two options:

  • Use the version-specific binaries: /usr/bin/php5.6, /usr/bin/php7.0, etc.

  • Set a default via update-alternatives:

    $ sudo update-alternatives --set php /usr/bin/php5.6

    If you're not sure what you have installed, use:

    $ sudo update-alternatives --config php

    which will give you a listing, and an ability to select the one to use.

Rootless alternatives

What if you'd rather not be root to switch the default version, though? Fortunately, update-alternatives allows specifying alternate config and admin directories.

Define the following alias in your shell's configuration:

alias update-my-alternatives='update-alternatives \ --altdir ~/.local/etc/alternatives \ --admindir ~/.local/var/lib/alternatives'

Additionally, make sure you add $HOME/.local/bin to your $PATH; since defining $PATH varies based on the shell you use, I'll leave that for you to accomplish.

If you open a new shell, the alias will now be available; alternately, source the file in which you defined it to have it take effect immediately.

Once you've done that, you can run the following, based on the PHP versions you've installed:

$ for VERSION in 5.6 7.0 7.1 7.2 7.3;do for> update-my-alternatives --install $HOME/.local/bin/php php /usr/bin/php${VERSION} ${VERSION//./0} for> done

This will create alternatives entries local to your own user, prioritizing them by version; as a result, the default, auto-selected version will be the most recently installed.

You can verify this by running update-my-alternatives --config php:

There are 5 choices for the alternative php (providing $HOME/.local/bin/php). Selection Path Priority Status ----------------

Truncated by Planet PHP, read more at the original (another 7281 bytes)

カテゴリー: php

Hubert 'depesz' Lubaczewski: Waiting for PostgreSQL 12 – Add SETTINGS option to EXPLAIN, to print modified settings.

planet postgresql - 2019-05-01(水) 03:22:52
On 3rd of April 2019, Tomas Vondra committed patch: Add SETTINGS option to EXPLAIN, to print modified settings.     Query planning is affected by a number of configuration options, and it may be crucial to know which of those options were set to non-default values. With this patch you can say EXPLAIN (SETTINGS ON) … Continue reading "Waiting for PostgreSQL 12 – Add SETTINGS option to EXPLAIN, to print modified settings."
カテゴリー: postgresql

Technical Thoughts, Tutorials, and Musings: PSR-14: Example - PSR-14 in a non-blocking application server

phpdeveloper.org - 2019-05-01(水) 00:00:02

PSR-14: Example - PSR-14 in a non-blocking application server

We continue our exploration of PSR-14's potential with a guest post. Cees-Jan Kiewiet was the Sponsor of PSR-14 (meaning the member of the Core Committee who bridged from the Working Group to the Core Committee), and is on...
カテゴリー: php

Pine: Handy RegEx Constraints in Laravel Routes

phpdeveloper.org - 2019-05-01(水) 00:00:02

It’s a well-known feature, but still in some cases it may require longer research to find the good regex patterns for defining constraints for our route parameters. Let’s see some idea.

Getting Started First of all, let’s see how to even use patterns to create rules for our rout...

カテゴリー: php

Voices of the ElePHPant: Interview with Kathy Forte

phpdeveloper.org - 2019-05-01(水) 00:00:02

Show Notes Kathy’s LinkedIn profile

Audio

This episode is sponsored byDay Camp 4 Developers

The post Interview with Kathy Forte appeared first on Voices of the ElePHPant.

カテゴリー: php

php[podcast] episodes from php[architect]: Frontend Fundamentals and Chris Hartjes

phpdeveloper.org - 2019-05-01(水) 00:00:02

In Episode 19 Eric, John, and Oscar record together again to discuss the April 2019 issue on the new frontend fundamentals, php[tek], and quite a lot more about web browsers than anyone anticipated. Topics Eric and John get a look behind the scenes into what goes into producing each magazine issu...

カテゴリー: php

423 Locked

planet PHP - 2019-05-01(水) 00:00:00

The 423 Locked status-code does not appear in the base HTTP specification, but is part of WebDAV specification, which is an extension to HTTP.

A major goal of WebDAV was to provide a ‘filesystem over the web’. One of its core features is for users to ‘lock’ specific files and directories to prevent others from editing them.

A user can lock a resource by issuing a http LOCK method and later on unlock the resource by using the UNLOCK HTTP method.

Both ‘shared locks’ and ‘exclusive locks’ are supported.

Example

Locking a resource

LOCK /article/5 HTTP/1.1 Content-Type: application/xml <?xml version="1.0"?> <d:lockinfo xmlns:d='DAV:'> <d:lockscope><d:exclusive/></d:lockscope> <d:locktype><d:write/></d:locktype> <d:owner>Evert</d:owner> </d:lockinfo>

A successful response to this includes a Lock-Token header.

HTTP/1.1 200 OK Content-Type: application/xml Lock-Token: <urn:uuid:e71d4fae-5dec-22d6-fea5-00a0c91e6be4> <?xml version="1.0"?> ...

If a user tries to make a change to a locked resource, they will get an error:

PUT /article/5 HTTP/1.1 Content-Type: text/plain New content HTTP/1.1 423 Locked Content-Type: application/xml <?xml version="1.0" encoding="utf-8" ?> <d:error xmlns:d="DAV:"> <d:lock-token-submitted> <d:href>/article/5</d:href> </d:lock-token-submitted> </d:error>

Unless, they also include the lock-token in the If header:

PUT /article/5 HTTP/1.1 Content-Type: text/plain If: <urn:uuid:e71d4fae-5dec-22d6-fea5-00a0c91e6be4> New content HTTP/1.1 204 No Content Usage on the web

I haven’t seen a lot of usage of LOCK, UNLOCK and the 423 code outside of WebDAV. However, I don’t see strong reasons against their usage.

A big part that the lock functionality of WebDAV hopes to solve, is avoiding problems with multiple users making updates on (groups of-) resources at the same time.

If you also have this issue, bear in mind that there is a more popular feature in HTTP to deal with this: Etags and the If-Match / If-None-Match headers.

These headers ten

Truncated by Planet PHP, read more at the original (another 1519 bytes)

カテゴリー: php

Community News: Latest PECL Releases (04.30.2019)

phpdeveloper.org - 2019-04-30(火) 22:05:01

Latest PECL Releases:

  • event 2.5.0
    Issue #53: Added EventConfig::setFlags() method. (There was no way to set EVENT_BASE_FLAG_* flags.)

  • uv 0.2.3
    - Fix Windows build - Fix PHP 7.4 build
  • gRPC 1.20.0
    - Added memory leak tests #17862 - Fixed segfault on accessing a closed client #18302 - Added ini settings for fork support #18539 - Fixed fork hang #18558
  • datadog_trace 0.20.0
    ### Added - Force tracing or discarding trace via special Span tag (manual.keep and manual.drop) #409 Fixed
    • Resource use by caching configuration values instead of processing data on every access #406
  • mysql_xdevapi 8.0.16
    WL#9879: Prepared statement support WL#11983: Support session-connect-attributes WL#12396: Support new session reset functionality orabug #28802543: classes: Driver, ExecutionStatus, Expression, and Statement orabug #28803208: the DocResult prototype appear wrong orabug #28803039: the fields() method seems odd orabug #28805757: how exactly are set() and replace() different?
カテゴリー: php

Eric Hanson: "Aquameta Revisited" on FLOSS Weekly

planet postgresql - 2019-04-30(火) 20:50:08

Eric talks about Aquameta 0.2 and the advantages of migrating the web stack into PostgreSQL on This Week in Tech's FLOSS Weekly.

カテゴリー: postgresql

Interview with Kathy Forte

planet PHP - 2019-04-30(火) 20:00:00

Show Notes Audio

This episode is sponsored by
Day Camp 4 Developers


The post Interview with Kathy Forte appeared first on Voices of the ElePHPant.

カテゴリー: php

Markus Winand: A Close Look at the Index Include Clause

planet postgresql - 2019-04-30(火) 09:00:00

Some database—namely Microsoft SQL Server, IBM Db2, and also PostgreSQL since release 11—offer an include clause in the create index statement. The introduction of this feature to PostgreSQL is the trigger for this long overdue explanation of the include clause.

Before going into the details, let’s start with a short recap on how (non-clustered) B-tree indexes work and what the all-mighty index-only scan is.

Recap: B-tree Indexes

To understand the include clause, you must first understand that using an index affects up to three layers of data structures:

  • The B-tree

  • The doubly linked list at the leaf node level of the B-tree

  • The table

The first two structures together form an index so they could be combined into a single item, i.e. the “B-tree index”. I prefer to keep them separate as they serve different needs and have a different impact on performance. Moreover, explaining the include clause requires making this distinction.

In the general case, the database software starts traversing the B-tree to find the first matching entry at the leaf node level (1). It then follows the doubly linked list until it has found all matching entries (2) and finally it fetches each of those matching entries from the table (3). Actually, the last two steps can be interleaved, but that is not relevant for understanding the general concept.

The following formulas give you a rough idea of how many read operations each of these steps needs. The sum of these three components is the total effort of an index access.0

  • The B-tree: log100(<rows in table>), often less than 5

  • The doubly linked list: <rows read from index> / 100

  • The table: <rows read from table>1

When loading a few rows, the B-tree makes the greatest contribution to the overall effort. As soon as you need to fetch just a handful of rows from the table, this step takes the lead. In either case—few or many rows—the doubly linked list is usually a minor factor because it stores rows with similar values next to each other so that a single read operation can fetch

[...]
カテゴリー: postgresql

PSR-14: Example - PSR-14 in a non-blocking application server

planet PHP - 2019-04-30(火) 05:51:00
PSR-14: Example - PSR-14 in a non-blocking application server

We continue our exploration of PSR-14's potential with a guest post. Cees-Jan Kiewiet was the Sponsor of PSR-14 (meaning the member of the Core Committee who bridged from the Working Group to the Core Committee), and is on the core team for ReactPHP. One wouldn't think there's any use cases for PSR-14 in an async environment like React, but one would be wrong.

Here's Cees-Jan with an explanation:

Continue reading this post on SteemIt.

Larry 29 April 2019 - 3:51pm
カテゴリー: php

Sebastian Insausti: An Overview of Streaming Replication for TimescaleDB

planet postgresql - 2019-04-29(月) 18:48:00

Nowadays, replication is a given in a high availability and fault tolerant environment for pretty much any database technology that you’re using. It is a topic that we have seen over and over again, but that never gets old.

If you’re using TimescaleDB, the most common type of replication is streaming replication, but how does it work?

In this blog, we are going to review some concepts related to replication and we’ll focus on streaming replication for TimescaleDB, which is a functionality inherited from the underlying PostgreSQL engine. Then, we’ll see how ClusterControl can help us to configure it.

So, streaming replication is based on shipping the WAL records and having them applied to the standby server. So, first, let’s see what WAL is.

WAL

Write Ahead Log (WAL) is a standard method for ensuring data integrity, it is automatically enabled by default.

The WALs are the REDO logs in TimescaleDB. But, what are the REDO logs?

REDO logs contain all changes that were made in the database and they are used by replication, recovery, online backup and point in time recovery (PITR). Any changes that have not been applied to the data pages can be redone from the REDO logs.

Using WAL results in a significantly reduced number of disk writes, because only the log file needs to be flushed to disk to guarantee that a transaction is committed, rather than every data file changed by the transaction.

A WAL record will specify, bit by bit, the changes made to the data. Each WAL record will be appended into a WAL file. The insert position is a Log Sequence Number (LSN) that is a byte offset into the logs, increasing with each new record.

The WALs are stored in the pg_wal directory, under the data directory. These files have a default size of 16MB (the size can be changed by altering the --with-wal-segsize configure option when building the server). They have a unique incremental name, in the following format: "00000001 00000000 00000000".

The number of WAL files contained in pg_wal will depend on the value assigned to the min_

[...]
カテゴリー: postgresql

PSR-14: Example - Delayed Events, Queues, and Asynchronicity

planet PHP - 2019-04-27(土) 07:34:00
PSR-14: Example - Delayed Events, Queues, and Asynchronicity

One of the long-running debates while designing PSR-14 was how to handle events that were inherently mono-directional. Often, a library will trigger an Event that is, from its point of view, entirely informational. The Event object it fires has no mutator methods so Listeners have no way to interact with each other, which means that the order Listeners run in is irrelevant. It also means Listeners can pass no data back to the emitting library, which means the result of the Event can have no impact on the Emitter's further logic.

This special case opens up more options for how to execute the Listeners. Because there is guaranteed no communication from Listener to Listener or from Listener to Emitter, it's safe to run the Listeners concurrently. In fact, it's safe to run the Listeners concurrently with the Emitter. The Emitter doesn't even need to wait for the Listeners to fire before continuing.

Continue reading this post on SteemIt.

Larry 26 April 2019 - 5:34pm
カテゴリー: php

ページ