DEV Community

Discussion on: The impact of migrating from PHP to Golang

freedom profile image
Freedom • Edited

In this case, how much more speed improvement did you estimate? Do you have the benchmark data in your recommendation?

Thread Thread
hackergaucho profile image
Hacker Gaucho • Edited

No. it's just a personal tip based on a quick search.

parallel processing is not new in php, there must be several other specific libraries.

personally i would try at least half a dozen of them before venturing into a new language.

Thread Thread
freedom profile image
Freedom

I understand, maybe it would be curious for you to compare if there are gains or performance improvement.

Thread Thread
roelofjanelsinga profile image
Roelof Jan Elsinga Author

I've tried a few libraries, extensions, and approaches, including:

  • ReactPHP components
  • AmpPHP components
  • Swoole PHP Extension
  • Asynchronous jobs on a Redis queue
  • Asynchronous jobs from the database
  • Multiple processing servers

They all worked, but only very temporarily. Take the jobs in the Redis queue for example: at a certain point, there were so many queued jobs that I was never able to work through all of them and the queue actually got bigger every day until it ran out of memory on day four.

I'd really like to revisit doing parallel processing in PHP though because it's much easier to implement something in the language the application is built with.

If I do find a nice solution to do everything in PHP, I'll definitely write about it. Finding a solution would be a great end of a very long journey and a great start for a new one!

Thread Thread
freedom profile image
Freedom

That's interesting to know, it seem PHP memory limit could be tune if the issue is related.

There are many solutions in PHP which is often difficult for me to make the decisions, has lead my way to Go (from PHP (pure and Laravel) to Swift to Nodejs to Ruby to Crystal to Go), it's a long journey and Go’s minimalistic approach actually… works. I assume it could probably help to avoid out of memory if you could experiment it and my finding that Go consumes less memory and gain better performance in various benchmark found on the web.

Thread Thread
hackergaucho profile image
Hacker Gaucho • Edited

surely Go is faster than PHP as well as any compiled language is often faster than script-based ones.

static typing languages like Go are also often faster than dynamic typing languages as well as the strong type system of Go also helps a lot.

Go is a more strong competitor for Java than PHP and Python IMHO.