欢迎来到 艾瑞可erik 的魔法世界 🧙‍♂️

给我一个需求,还你一个项目——别管它是什么。这就是全栈。

📚 291 篇文章 🏷️ 504 个标签 📂 90 个分类

🔥 最新文章

增加索引 + 异步 + 不落地后,从 12h 优化到 15 min

在开发中,我们经常会遇到这样的需求,将数据库中的图片导出到本地,再传给别人。

一、一般我会这样做:

1.通过接口或者定时任务的形式

2.读取Oracle或者MySQL数据库

3.通过FileOutputStream将Base64解密后的byte[]存储到本地

4.遍历本地文件夹,将图片通过FTP上传到第三方服务器

From 12h to 15 min: Indexes, Async, and No Disk Writes

In development, we often run into a requirement like this: export images from the database to the local machine, then pass them on to someone else.

1. Normally I would do it like this:

  1. Through an interface or a scheduled task

  2. Read from an Oracle or MySQL database

  3. Use FileOutputStream to store the Base64-decoded byte[] locally

  4. Walk the local folder and upload the images to a third-party server over FTP

5分钟搞定Jenkis

什么是持续集成

持续集成 Continuous integration ,简称CI随着软件开发复杂度的不断提高,团队开发成员间如何更好地协同工作以确保软件开发的质量已经慢慢成为开发过程中不可回避的问题。尤其是近些年来,敏捷(Agile) 在软件工程领域越来越红火,如何能在不断变化的需求中快速适应和保证软件的质量也显得尤其的重要。持续集成正是针对这一类问题的一种软件开发实践。它倡导团队开发成员必须经常集成他们的工作,甚至每天都可能发生多次集成。而每次的集成都是通过自动化的构建来验证,包括自动编译、发布和测试,从而尽快地发现集成错误,让团队能够更快的开发内聚的软件。

Jenkins in 5 Minutes

What Is Continuous Integration

Continuous integration, or CI for short. As software development grows ever more complex, how team members can better work together to ensure software quality has slowly become an unavoidable problem in the development process. Especially in recent years, as Agile has become increasingly popular in the software engineering field, being able to quickly adapt to constantly changing requirements while guaranteeing software quality has become particularly important. Continuous integration is a software development practice aimed precisely at this class of problems. It advocates that team members must integrate their work frequently, possibly many times a day. Each integration is verified through an automated build, including automatic compilation, release and testing, so that integration errors are found as quickly as possible and the team can develop cohesive software faster.

xhprof插件开发

最近开发后总要测试接口性能,来定位接口问题,突然想到有xhprof扩展可以用。翻了翻,发现多数要不代码不更新,要不就是太繁琐,干脆自己开发以下。

参考phacility/xhprof、phpxxb/xhprof的项目,自己下载了一份代码。于是就先做了webman的插件xhprof-webman,磨蹭了一段时间就又弄了laravel版的插件xhprof-laravel。最新版已更新,大家有用到的去composer安装吧。

xhprof Plugin Development

Lately I always have to test interface performance after development to pin down interface problems, and it suddenly occurred to me that the xhprof extension could be used. I looked around and found that most of them either are no longer updated or are just too cumbersome, so I simply developed my own.

Referring to the phacility/xhprof and phpxxb/xhprof projects, I downloaded a copy of the code myself. So first I made the webman plugin xhprof-webman, and after dawdling for a while I made the laravel version of the plugin xhprof-laravel. The latest versions have been updated, so if you find them useful, go install them with composer.

DataHub Installation Tutorial

I stumbled on DataHub and it looked pretty good, so here’s a single-node deployment.

  1. Install Docker locally, cd into the /opt or home directory, and run the following commands (blocked in China):

     git clone https://github.com/linkedin/datahub.git
    
     cd /opt/datahub/docker
    
     datahub docker quickstart -f ./quickstart/docker-compose-without-neo4j.quickstart.yml
    
     source ./quickstart.sh
    

PHP order matching algorithm

When buying and selling on the same platform, orders need to be matched. Similar amounts are combined in descending order. At first I wanted to use mq to separately match integer multiples of amounts, but I always felt it wasn’t quite perfect. Recently I happened to have some free time, so I found the “monkey chooses the king” algorithm:

MYSQL 最朴素的监控方式

对于当前数据库的监控方式有很多,分为数据库自带、商用、开源三大类,每一种都有各自的特色;而对于 mysql 数据库由于其有很高的社区活跃度,监控方式更是多种多样,不管哪种监控方式最核心的就是监控数据,获取得到全面的监控数据后就是灵活的展示部分。那我们今天就介绍一下完全采用 mysql 自有方式采集获取监控数据,在单体下达到最快速、方便、损耗最小。

The most plain way to monitor MYSQL

There are many ways to monitor a database today, split into three broad categories: built into the database, commercial, and open source, each with its own characteristics; and for the mysql database, thanks to its highly active community, monitoring approaches are even more varied. Regardless of the monitoring approach, the core is the monitoring data, and after obtaining comprehensive monitoring data comes the flexible presentation part. So today let’s introduce collecting and obtaining monitoring data entirely using mysql’s own facilities, achieving the fastest, most convenient and least overhead approach for a single instance.

通用的支付系统该如何设计

支付永远是一个公司的核心领域,因为这是一个有交易属性公司的命脉。那么,支付系统到底长什么样,又是怎么运行交互的呢?抛开带有支付牌照的金融公司的支付架构,下述链路和系统组成基本上符合绝大多数支付场景。其实整体可以看成是交易核心+支付核心 两个大系统。交易系统关联了业务场景和底层支付,而支付系统完成了调用支付工具到对账清算等一系列相关操作。下面我们就来一起看下各个系统的核心组成和交互。

How Should a General-Purpose Payment System Be Designed

Payment is always a core domain of a company, because it is the lifeline of any company with a transactional nature. So what does a payment system actually look like, and how does it run and interact? Setting aside the payment architecture of financial companies that hold payment licenses, the links and system composition described below basically fit the vast majority of payment scenarios. In fact, the whole thing can be seen as two big systems: a transaction core + a payment core. The transaction system connects business scenarios with the underlying payment, while the payment system completes a series of related operations from invoking payment instruments to reconciliation and settlement. Let’s take a look at the core composition and interaction of each system.

40个 Nginx 常问面试题

什么是 Nginx?


Nginx 是一个 轻量级 / 高性能的反向代理 Web 服务器,用于 HTTP、HTTPS、SMTP、POP3 和 IMAP 协议。他实现非常高效的反向代理、负载平衡,他可以处理 2-3 万并发连接数,官方监测能支持 5 万并发,现在中国使用 nginx 网站用户有很多,例如:新浪、网易、 腾讯等。

Nginx 有哪些优点?
  • 跨平台、配置简单。

  • 非阻塞、高并发连接:处理 2-3 万并发连接数,官方监测能支持 5 万并发。

  • 内存消耗

40 Common Nginx Interview Questions

What is Nginx?


Nginx is a lightweight / high-performance reverse proxy web server, used for the HTTP, HTTPS, SMTP, POP3 and IMAP protocols. It implements very efficient reverse proxying and load balancing. It can handle 20,000-30,000 concurrent connections, and official monitoring shows it can support 50,000 concurrent connections. Many website users in China use nginx today, for example: Sina, NetEase, Tencent and others.

What are Nginx’s advantages?
  • Cross-platform, simple configuration.

  • Non-blocking, high-concurrency connections: handles 20,000-30,000 concurrent connections, with official monitoring supporting 50,000 concurrent connections.

  • Memory consumption