Как хранятся заказы корзины каталога
Как применяется механизм карты спотов для распределения данных
Как встроить код роутинга запросов в active record фреймворка Laravel
Как написать behat-тесты, покрывающие распределенную структуру хранения
DjangoGirls Seoul 2017 11월 세미나에서 발표한 문서입니다.
- 소스 코드 : https://github.com/hannal/pieces-of-django-admin-djangogirls-seoul
- 각종 소식 : https://fb.com/hello.kaycha
A presentation on how to semi-automatically build CRUD application prototypes using PHP and some PEAR libraries. This was way before Rails became popular and automatic form generation for web applications was not as common as it is now.
Also, it was the first public presentation I ever held. Ah, those were the times ;-)
Originally held at the International PHP Conference 2004 in Amsterdam, although these slides have been updated by project contributors to reflect feature additions that were implemented later.
The Odoo Framework is quite expressive, many add-ons can express a lot of business logic just by defining models (in Python) and template/views (in XML). This is fine for most cases, but there is a limit to what you can do. To overcome this limit, you need to extend the Odoo web client in Javascript. Version 12 will feature a new large refactoring of the web client, and this training is a good opportunity to learn where Odoo is going.
This presentation emphasis on How to connect a Play Application with Mysql as database in Scala.Play includes a simple data access layer called Anorm that uses plain SQL to interact with the database and provides an API to parse and transform the resulting datasets.
Beyond php - it's not (just) about the codeWim Godden
Most PHP developers focus on writing code. But creating Web applications is about much more than just wrting PHP. Take a step outside the PHP cocoon and into the big PHP ecosphere to find out how small code changes can make a world of difference on servers and network. This talk is an eye-opener for developers who spend over 80% of their time coding, debugging and testing.
DjangoGirls Seoul 2017 11월 세미나에서 발표한 문서입니다.
- 소스 코드 : https://github.com/hannal/pieces-of-django-admin-djangogirls-seoul
- 각종 소식 : https://fb.com/hello.kaycha
A presentation on how to semi-automatically build CRUD application prototypes using PHP and some PEAR libraries. This was way before Rails became popular and automatic form generation for web applications was not as common as it is now.
Also, it was the first public presentation I ever held. Ah, those were the times ;-)
Originally held at the International PHP Conference 2004 in Amsterdam, although these slides have been updated by project contributors to reflect feature additions that were implemented later.
The Odoo Framework is quite expressive, many add-ons can express a lot of business logic just by defining models (in Python) and template/views (in XML). This is fine for most cases, but there is a limit to what you can do. To overcome this limit, you need to extend the Odoo web client in Javascript. Version 12 will feature a new large refactoring of the web client, and this training is a good opportunity to learn where Odoo is going.
This presentation emphasis on How to connect a Play Application with Mysql as database in Scala.Play includes a simple data access layer called Anorm that uses plain SQL to interact with the database and provides an API to parse and transform the resulting datasets.
Beyond php - it's not (just) about the codeWim Godden
Most PHP developers focus on writing code. But creating Web applications is about much more than just wrting PHP. Take a step outside the PHP cocoon and into the big PHP ecosphere to find out how small code changes can make a world of difference on servers and network. This talk is an eye-opener for developers who spend over 80% of their time coding, debugging and testing.
Beyond PHP - It's not (just) about the codeWim Godden
Most PHP developers focus on writing code. But creating Web applications is about much more than just wrting PHP. Take a step outside the PHP cocoon and into the big PHP ecosphere to find out how small code changes can make a world of difference on servers and network. This talk is an eye-opener for developers who spend over 80% of their time coding, debugging and testing.
Beyond php - it's not (just) about the codeWim Godden
Most PHP developers focus on writing code. But creating Web applications is about much more than just wrting PHP. Take a step outside the PHP cocoon and into the big PHP ecosphere to find out how small code changes can make a world of difference on servers and network. This talk is an eye-opener for developers who spend over 80% of their time coding, debugging and testing.
Beyond PHP - it's not (just) about the codeWim Godden
Most PHP developers focus on writing code. But creating Web applications is about much more than just writing PHP. Take a step outside the PHP cocoon and into the big PHP ecosphere to find out how small code changes can make a world of difference on servers and network. This talk is an eye-opener for developers who spend over 80% of their time coding, debugging and testing.
Работа с реляционными базами данных в C++corehard_by
Поговорим в первую очередь о библиотеках, которые унифицируют работу с различными БД: Oracle, MSSQL, Postgres, MySQL и др. Я поделюсь своим опытом работы с некоторыми из них. А также посмотрим, что может нас ожидать в будущем в плане работы с SQL базами данных.
"Quem já trabalhou numa startup sabe como funciona o processo de desenvolvimento. "Faça rápido e no futuro a gente arruma." Acontece que quando o "futuro" chega, ele chega rasgando, te acordando de madrugada com notificações e com clientes reclamando. Nessa apresentação vou mostrar várias técnicas não muito difundidas para melhorar a performance do seu app escrito com Rails e fazer você dormir mais.
Internationalizing CakePHP ApplicationsPierre MARTIN
Slides from the talk given by Mariano Iglesias during the CakeFest #3 - July 2009
Note: the original pdf and the code related to this talk can be found on cakephp.org (http://cakephp.org/downloads/CakeFest/CakeFest%203%20-%20Berlin%202009/Mariano%20Iglesias%20-%20Internationalizing%20CakePHP%20Applications)
Distributed Queries in IDS: New features.Keshav Murthy
Learn about the latest function relating to distributed queries that was delivered in IBM Informix® Dynamic Server (IDS) 11 and 11.5. This talk will provide an overview of distributed queries, then will jump into a deep dive on the latest functions and how you can benefit from implementing distributed queries in your solutions.
I inherited a MongoDB database server with 60 collections and 100 or so indexes.
The business users are complaining about slow report completion times. What can I do to improve performance?
The optimizer is the brain of any DBMS system, This presentation helps to understand MongoDB explain plan metrics and How MongoDB Optimiser scores for each query plan and choosing the proper query plan for the execution.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
More Related Content
Similar to Шардинг заказов корзины каталога Onliner.by
Beyond PHP - It's not (just) about the codeWim Godden
Most PHP developers focus on writing code. But creating Web applications is about much more than just wrting PHP. Take a step outside the PHP cocoon and into the big PHP ecosphere to find out how small code changes can make a world of difference on servers and network. This talk is an eye-opener for developers who spend over 80% of their time coding, debugging and testing.
Beyond php - it's not (just) about the codeWim Godden
Most PHP developers focus on writing code. But creating Web applications is about much more than just wrting PHP. Take a step outside the PHP cocoon and into the big PHP ecosphere to find out how small code changes can make a world of difference on servers and network. This talk is an eye-opener for developers who spend over 80% of their time coding, debugging and testing.
Beyond PHP - it's not (just) about the codeWim Godden
Most PHP developers focus on writing code. But creating Web applications is about much more than just writing PHP. Take a step outside the PHP cocoon and into the big PHP ecosphere to find out how small code changes can make a world of difference on servers and network. This talk is an eye-opener for developers who spend over 80% of their time coding, debugging and testing.
Работа с реляционными базами данных в C++corehard_by
Поговорим в первую очередь о библиотеках, которые унифицируют работу с различными БД: Oracle, MSSQL, Postgres, MySQL и др. Я поделюсь своим опытом работы с некоторыми из них. А также посмотрим, что может нас ожидать в будущем в плане работы с SQL базами данных.
"Quem já trabalhou numa startup sabe como funciona o processo de desenvolvimento. "Faça rápido e no futuro a gente arruma." Acontece que quando o "futuro" chega, ele chega rasgando, te acordando de madrugada com notificações e com clientes reclamando. Nessa apresentação vou mostrar várias técnicas não muito difundidas para melhorar a performance do seu app escrito com Rails e fazer você dormir mais.
Internationalizing CakePHP ApplicationsPierre MARTIN
Slides from the talk given by Mariano Iglesias during the CakeFest #3 - July 2009
Note: the original pdf and the code related to this talk can be found on cakephp.org (http://cakephp.org/downloads/CakeFest/CakeFest%203%20-%20Berlin%202009/Mariano%20Iglesias%20-%20Internationalizing%20CakePHP%20Applications)
Distributed Queries in IDS: New features.Keshav Murthy
Learn about the latest function relating to distributed queries that was delivered in IBM Informix® Dynamic Server (IDS) 11 and 11.5. This talk will provide an overview of distributed queries, then will jump into a deep dive on the latest functions and how you can benefit from implementing distributed queries in your solutions.
I inherited a MongoDB database server with 60 collections and 100 or so indexes.
The business users are complaining about slow report completion times. What can I do to improve performance?
The optimizer is the brain of any DBMS system, This presentation helps to understand MongoDB explain plan metrics and How MongoDB Optimiser scores for each query plan and choosing the proper query plan for the execution.
Similar to Шардинг заказов корзины каталога Onliner.by (20)
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
10. class PreviewUpdater
{
public function created(Order $order)
{
OrderPreview::create([
'id' => $order->id,
'user_id' => $order->user_id,
'status' => $order->status,
// ...
]);
}
public function updated(Order $order)
{
/** @var OrderPreview $orderPreview */
$orderPreview = OrderPreview::find($order->id);
$orderPreview->user_id = $order->user_id;
$orderPreview->status = $order->status;
// ...
$orderPreview->save();
}
public function deleted(Order $order)
{
OrderPreview::destroy($order->id);
}
}
11. abstract class Model extends EloquentModel
{
public static function find($id, $columns = ['*'])
{
if (is_array($id)) {
return static::findMany($id, $columns);
}
return static::spotQuery(Map::spot($id))->find($id, $columns);
}
public static function spotQuery(Spot $spot)
{
$instance = new static;
$instance->spot = $spot;
$connection = $instance->spotConnection($spot);
$builder = $instance->newEloquentBuilder(
new QueryBuilder($connection, $connection->getQueryGrammar(), $connection->getPostProcessor())
);
return $builder->setModel($instance);
}
// ...
}
12. $order = OrderPreview::orderQuery()->whereOrderKey($orderId)->first();
class OrderPreview extends Model
{
public static function orderQuery()
{
$instance = new static;
return (new QueryBuilder($instance->newBaseQueryBuilder(), new Order))->setModel($instance);
}
}
class QueryBuilder extends Builder
{
/** @var Model */
private $spotted;
private $with = [];
public function getModels($columns = ['*'])
{
return $this->spotted->findMany(array_pluck(parent::getModels($columns), 'id'), $columns,
$this->with)->all();
}
}
Запросы через превью
13. abstract class Model extends EloquentModel
{
public function hasMany($related, $foreignKey = null, $localKey = null)
{
//...
$instance = new $related;
$instance->spot = $this->spot();
return new HasMany(/*...*/, $instance->getTable() . '.' . $foreignKey);
}
}
Поддержка relations
14. Scenario: Spots with different databases
Given spots map contains spots:
| start_id | finish_id | connection_name | database | spot_prefix |
| 1 | 1 | catalog_cart | <test_db> | |
| 2 | 2 | catalog_cart_spot2 | <test_db>_spot2 | |
# ...
When I send POST request to "/orders"
Then request expectations should be met
And log file should be empty
And response status code should be 201
And SQL query "select * from <test_db>.orders" result should be like:
| id | user_id | shop_id | status | delivery_city | delivery_address | comment |
| 1 | 1 | 1 | 0 | Минск | пр-т Дзержинского, 5 | comment1 |
# ...
Behat-сценарии для спотов
16. Генерация ID
● Auto-increment ID (1, 2, 3, …)
○ Закрыть информацию
○ Шардинг
● Hashids (3jR-OCl4rG0)
○ Number vector
○ Недостаточно безопасные
● UUID (550e8400-e29b-41d4-a716-446655440000)
○ Нечитаемые
● ID sequence
○ Читаемый набор символов (без i и 1)
○ Единый центр выдачи идентификаторов
○ Механизм отслеживания коллизий
17. $this->sequence = $connection->table('order_id_sequence');
// ...
for ($i = 1; $i <= config('order.key.collisions.limit'); $i++) {
try {
$order->key = $this->generateOrderKey();
$order->id = $this->sequence->insertGetId(['order_key' => $order->key]);
return;
} catch (QueryException $ex) {
if ($ex->getCode() != 23000) { // Integrity constraint violation
throw $ex;
}
}
if ($i == config('order.key.collisions.warning')) {
(new OnlinerLogger)->warning(
"cart-api: $i collisions occurred, think about increasing of order key length"
);
}
}
throw new RuntimeException(
"Failed to generate key for order from user {$order->user_id} to shop {$order->user_id}"
);
18. class Order extends SpotsModel
{
public $incrementing = false;
protected $spotIdKey = 'id';
protected $table = 'orders';
public function statusLogEntries()
{
return $this->hasMany(OrderStatusLogEntry::class);
}
public function save(array $options = [])
{
if (!$this->exists) {
// ...
app(IdGenerator::class)->generate($this);
}
return parent::save($options);
}
protected static function boot()
{
parent::boot();
// ...
static::observe(PreviewUpdater::class);
}
}
Editor's Notes
Привет, петр трофимов, спасибо, несмотря на дедлайны, чтото полезное, вопросы в конце
1 мин
Кто заказывает товары через корзину в каталоге? Поднять
Кто нет? А кто будет теперь? (из названия хехе)
До этого - телефоны, але?, рога и копыта, нету да, положить денег на телефон
Октябрь 2015 - декабрь 2015
Все проще, нажимаем, превращается вот в такую
Конечно не все так просто, там еще эту и эту нажать
Уведомление
3 мин
Какова специфика каталога онлайнер? 800 тысяч, 600, 1000, 5 млн
Заказов больше, чем в одиночном магазине - много данных
Много разнородных магазинов - частые обновления, получить актуальные данные
Частые изменения прайсов - фиксация данных, много данных
Состав может меняться - нужно фиксировать, снэпшоты, много данных
Заказы храним очень долго, пока не удалят - много данных, чем старше тем ненужнее
Можно ли сохранить в одной таблице? Приватные сообщения
Шардинг в начале, потом очень сложно
Что происходит после нажатия кнопки отправить заказ?
4 мин
Разбивка по магазину, JWT токен, микросервисы, внутренние запросы, выбор хранилища
Кусочек данных, перенос между серверами, балансировка, закрытие открытие
Что из себя представляет карта?
Просто таблица, неравномерные диапазоны, хост, база, префикс, открытые диапазоны
Все ходят в эту таблицу? Нет, офлайн сброс
Абстрактный, спот айди,
Выбор спота, переопределить системный метод подключения,
Сет подключения в конфиг, выбор таблицы - переопределить
Спотов много, делать запрос к каждому?
Запись и туда и туда, чтение через превью, репликация ()
Листенер, создание, обновление, удаление
Метод поиска, выбор подключения
Что такое релейшнс, связанные таблицы, ограничение - один спот, джойны
Коллизии - 5 и 100, уникальный индекс,
Кто знает что такое Hashids? Реакция - ты крутой
Сиквенс обычная таблица, несколько попыток перед исключением,
Вставка в уникальный индекс, ловим исключение,
Ворнинг
Спец родительский класс, отключаем автоинкремент,
Указываем спотируемое поле, таблица обычное имя,
Релейшны можно, генерация айди,
Превью апдейтер, сколько нужно